********************
* Partisan consent *
********************

* Importing data
****************

cd "/Users/damienbol/Library/CloudStorage/GoogleDrive-damien.bol@sciencespo.fr/My Drive/Projects Blais-Bol-Plescia/Data/"

import delimited data_2024_03_06_clean.csv, clear

* Reconstructing missing variable
**********************************

gen totalvotescoalition1=0
replace totalvotescoalition1=totalvotescoalition1+cdupercentage1 if cduincoalition1=="yes"
replace totalvotescoalition1=totalvotescoalition1+afdpercentage1 if afdincoalition1=="yes"
replace totalvotescoalition1=totalvotescoalition1+spdpercentage1 if spdincoalition1=="yes"
replace totalvotescoalition1=totalvotescoalition1+grünepercentage1 if grüneincoalition1=="yes"
replace totalvotescoalition1=totalvotescoalition1+fdppercentage1 if fdpincoalition1=="yes"
replace totalvotescoalition1=totalvotescoalition1+bswpercentage1 if bswincoalition1=="yes"
replace totalvotescoalition1=totalvotescoalition1+dielinkepercentage1 if dielinkeincoalition1=="yes"

gen spdcoalitionseats1=spdpercentage1/totalvotescoalition1*100
replace spdcoalitionseats1=round(spdcoalitionseats1)
replace spdcoalitionseats1=0 if spdincoalition1!="yes"

* Identifying most liked and most disliked parties
**************************************************

gen q6_recoded=. // Manually recoding q6

replace q6_recoded=1 if q6selectedparty=="CDU/CSU"
replace q6_recoded=2 if q6selectedparty=="AfD"
replace q6_recoded=2 if q6selectedparty=="Afd"
replace q6_recoded=3 if q6selectedparty=="SPD"
replace q6_recoded=4 if q6selectedparty=="Grün"
replace q6_recoded=4 if q6selectedparty=="Grüne"
replace q6_recoded=5 if q6selectedparty=="FDP"
replace q6_recoded=6 if q6selectedparty=="BSW"
replace q6_recoded=7 if q6selectedparty=="Die Linke"

gen q7_recoded=. // Manually recoding q7

replace q7_recoded=1 if q7selectedparty=="CDU/CSU"
replace q7_recoded=2 if q7selectedparty=="AfD"
replace q7_recoded=2 if q7selectedparty=="Afd"
replace q7_recoded=3 if q7selectedparty=="SPD"
replace q7_recoded=4 if q7selectedparty=="Grün"
replace q7_recoded=4 if q7selectedparty=="Grüne"
replace q7_recoded=5 if q7selectedparty=="FDP"
replace q7_recoded=6 if q7selectedparty=="BSW"
replace q7_recoded=7 if q7selectedparty=="Die Linke"
replace q7_recoded=7 if q7selectedparty=="The left"

* Calculating most liked pârty

replace q5a=. if q5a==99 // Removing don't knows
replace q5b=. if q5b==99
replace q5c=. if q5c==99
replace q5d=. if q5d==99
replace q5e=. if q5e==99
replace q5f=. if q5f==99
replace q5g=. if q5g==99

gen max_liking=max(q5a, q5b, q5c, q5d, q5e, q5f, q5g) // Calculating max liking

gen fav1=0 // Creating variables
gen fav2=0
gen fav3=0
gen fav4=0
gen fav5=0
gen fav6=0
gen fav7=0

replace fav1=1 if q5a==max_liking // Assigning max likings to the variables
replace fav2=1 if q5b==max_liking
replace fav3=1 if q5c==max_liking
replace fav4=1 if q5d==max_liking
replace fav5=1 if q5e==max_liking
replace fav6=1 if q5f==max_liking
replace fav7=1 if q5g==max_liking

gen tie=fav1+fav2+fav3+fav4+fav5+fav6+fav7 // Identifying ties

replace fav1=0 if q6_recoded!=1 & tie>1 // Breaking ties
replace fav2=0 if q6_recoded!=2 & tie>1
replace fav3=0 if q6_recoded!=3 & tie>1
replace fav4=0 if q6_recoded!=4 & tie>1
replace fav5=0 if q6_recoded!=5 & tie>1
replace fav6=0 if q6_recoded!=6 & tie>1
replace fav7=0 if q6_recoded!=7 & tie>1

gen tie_bis=fav1+fav2+fav3+fav4+fav5+fav6+fav7 // Removing respondents with ties who didn't answer the tie question
replace fav1=. if tie_bis==0
replace fav2=. if tie_bis==0
replace fav3=. if tie_bis==0
replace fav4=. if tie_bis==0
replace fav5=. if tie_bis==0
replace fav6=. if tie_bis==0
replace fav7=. if tie_bis==0

* Calculatign most disliked party

gen min_liking=min(q5a, q5b, q5c, q5d, q5e, q5f, q5g)  // Calculating min likings

gen least1=0 // Creating the variables
gen least2=0
gen least3=0
gen least4=0
gen least5=0
gen least6=0
gen least7=0

replace least1=1 if q5a==min_liking // Assigning min likings to the variables 
replace least2=1 if q5b==min_liking
replace least3=1 if q5c==min_liking
replace least4=1 if q5d==min_liking
replace least5=1 if q5e==min_liking
replace least6=1 if q5f==min_liking
replace least7=1 if q5g==min_liking

gen tie2=least1+least2+least3+least4+least5+least6+least7 // Identifying ties

replace least1=0 if q7_recoded!=1 & tie2>1 // Breaking ties
replace least2=0 if q7_recoded!=2 & tie2>1
replace least3=0 if q7_recoded!=3 & tie2>1
replace least4=0 if q7_recoded!=4 & tie2>1
replace least5=0 if q7_recoded!=5 & tie2>1
replace least6=0 if q7_recoded!=6 & tie2>1
replace least7=0 if q7_recoded!=7 & tie2>1

gen tie2_bis=least1+least2+least3+least4+least5+least6+least7  // Removing respondents with ties who didn't answer the tie question
replace least1=. if tie2_bis==0
replace least2=. if tie2_bis==0
replace least3=. if tie2_bis==0
replace least4=. if tie2_bis==0
replace least5=. if tie2_bis==0
replace least6=. if tie2_bis==0
replace least7=. if tie2_bis==0

* Identifying those with mild preferences

gen q5a_bis=q5a // Recoding the liking of the favorite party to missing value
gen q5b_bis=q5b
gen q5c_bis=q5c
gen q5d_bis=q5d
gen q5e_bis=q5e
gen q5f_bis=q5f
gen q5g_bis=q5g

replace q5a_bis=. if fav1==1
replace q5b_bis=. if fav2==1
replace q5c_bis=. if fav3==1
replace q5d_bis=. if fav4==1
replace q5e_bis=. if fav5==1
replace q5f_bis=. if fav6==1
replace q5g_bis=. if fav7==1

gen second_max=max(q5a_bis, q5b_bis, q5c_bis, q5d_bis, q5e_bis, q5f_bis, q5g_bis) // Calculating second max liking

gen gap_liking=max_liking-second_max // Calculating gap between first and second max likings

gen mild_pref=0 // Identifying those with mild preferences for favorite party
replace mild_pref=1 if gap_liking<2

tab mild_pref

gen q5a_ter=q5a // Recoding the liking of most disliked party to missing value
gen q5b_ter=q5b
gen q5c_ter=q5c
gen q5d_ter=q5d
gen q5e_ter=q5e
gen q5f_ter=q5f
gen q5g_ter=q5g

replace q5a_ter=. if least1==1
replace q5b_ter=. if least2==1
replace q5c_ter=. if least3==1
replace q5d_ter=. if least4==1
replace q5e_ter=. if least5==1
replace q5f_ter=. if least6==1
replace q5g_ter=. if least7==1

gen second_min=min(q5a_ter, q5b_ter, q5c_ter, q5d_ter, q5e_ter, q5f_ter, q5g_ter) // Calculating second min liking

gen gap_liking_bis=min_liking-second_min // Calculating gap between first and second min likings

gen mild_pref_bis=0 // Identifying those with mild preferences for most disliked party
replace mild_pref_bis=1 if gap_liking_bis<2

tab mild_pref_bis // 96% of respondents with mild pref for most disliked party


* Calculating performance variables of most liked party
********************************************************

replace cdupercentage1=cdupercentage1/100 // Transforming percentages into proportions
replace cdupercentage2=cdupercentage2/100
replace cdupercentage3=cdupercentage3/100
replace cdupercentage4=cdupercentage4/100
replace cdupercentage5=cdupercentage5/100

replace afdpercentage1=afdpercentage1/100
replace afdpercentage2=afdpercentage2/100
replace afdpercentage3=afdpercentage3/100
replace afdpercentage4=afdpercentage4/100
replace afdpercentage5=afdpercentage5/100

replace spdpercentage1=spdpercentage1/100
replace spdpercentage2=spdpercentage2/100
replace spdpercentage3=spdpercentage3/100
replace spdpercentage4=spdpercentage4/100
replace spdpercentage5=spdpercentage5/100

replace grünepercentage1=grünepercentage1/100
replace grünepercentage2=grünepercentage2/100
replace grünepercentage3=grünepercentage3/100
replace grünepercentage4=grünepercentage4/100
replace grünepercentage5=grünepercentage5/100

replace fdppercentage1=fdppercentage1/100
replace fdppercentage2=fdppercentage2/100
replace fdppercentage3=fdppercentage3/100
replace fdppercentage4=fdppercentage4/100
replace fdppercentage5=fdppercentage5/100

replace bswpercentage1=bswpercentage1/100
replace bswpercentage2=bswpercentage2/100
replace bswpercentage3=bswpercentage3/100
replace bswpercentage4=bswpercentage4/100
replace bswpercentage5=bswpercentage5/100

replace dielinkepercentage1=dielinkepercentage1/100
replace dielinkepercentage2=dielinkepercentage2/100
replace dielinkepercentage3=dielinkepercentage3/100
replace dielinkepercentage4=dielinkepercentage4/100
replace dielinkepercentage5=dielinkepercentage5/100


replace cducoalitionseats1=0 if cducoalitionseats1==.
replace cducoalitionseats2=0 if cducoalitionseats2==.
replace cducoalitionseats3=0 if cducoalitionseats3==.
replace cducoalitionseats4=0 if cducoalitionseats4==.
replace cducoalitionseats5=0 if cducoalitionseats5==.

replace cducoalitionseats1=cducoalitionseats1/100
replace cducoalitionseats2=cducoalitionseats2/100
replace cducoalitionseats3=cducoalitionseats3/100
replace cducoalitionseats4=cducoalitionseats4/100
replace cducoalitionseats5=cducoalitionseats5/100

replace afdcoalitionseats1=0 if afdcoalitionseats1==.
replace afdcoalitionseats2=0 if afdcoalitionseats2==.
replace afdcoalitionseats3=0 if afdcoalitionseats3==.
replace afdcoalitionseats4=0 if afdcoalitionseats4==.
replace afdcoalitionseats5=0 if afdcoalitionseats5==.

replace afdcoalitionseats1=afdcoalitionseats1/100
replace afdcoalitionseats2=afdcoalitionseats2/100
replace afdcoalitionseats3=afdcoalitionseats3/100
replace afdcoalitionseats4=afdcoalitionseats4/100
replace afdcoalitionseats5=afdcoalitionseats5/100

replace spdcoalitionseats1=0 if spdcoalitionseats1==.
replace spdcoalitionseats2=0 if spdcoalitionseats2==.
replace spdcoalitionseats3=0 if spdcoalitionseats3==.
replace spdcoalitionseats4=0 if spdcoalitionseats4==.
replace spdcoalitionseats5=0 if spdcoalitionseats5==.

replace spdcoalitionseats1=spdcoalitionseats1/100
replace spdcoalitionseats2=spdcoalitionseats2/100
replace spdcoalitionseats3=spdcoalitionseats3/100
replace spdcoalitionseats4=spdcoalitionseats4/100
replace spdcoalitionseats5=spdcoalitionseats5/100

replace grünecoalitionseats1=0 if grünecoalitionseats1==.
replace grünecoalitionseats2=0 if grünecoalitionseats2==.
replace grünecoalitionseats3=0 if grünecoalitionseats3==.
replace grünecoalitionseats4=0 if grünecoalitionseats4==.
replace grünecoalitionseats5=0 if grünecoalitionseats5==.

replace grünecoalitionseats1=grünecoalitionseats1/100
replace grünecoalitionseats2=grünecoalitionseats2/100
replace grünecoalitionseats3=grünecoalitionseats3/100
replace grünecoalitionseats4=grünecoalitionseats4/100
replace grünecoalitionseats5=grünecoalitionseats5/100

replace fdpcoalitionseats1=0 if fdpcoalitionseats1==.
replace fdpcoalitionseats2=0 if fdpcoalitionseats2==.
replace fdpcoalitionseats3=0 if fdpcoalitionseats3==.
replace fdpcoalitionseats4=0 if fdpcoalitionseats4==.
replace fdpcoalitionseats5=0 if fdpcoalitionseats5==.

replace fdpcoalitionseats1=fdpcoalitionseats1/100
replace fdpcoalitionseats2=fdpcoalitionseats2/100
replace fdpcoalitionseats3=fdpcoalitionseats3/100
replace fdpcoalitionseats4=fdpcoalitionseats4/100
replace fdpcoalitionseats5=fdpcoalitionseats5/100

replace bswcoalitionseats1=0 if bswcoalitionseats1==.
replace bswcoalitionseats2=0 if bswcoalitionseats2==.
replace bswcoalitionseats3=0 if bswcoalitionseats3==.
replace bswcoalitionseats4=0 if bswcoalitionseats4==.
replace bswcoalitionseats5=0 if bswcoalitionseats5==.

replace bswcoalitionseats1=bswcoalitionseats1/100
replace bswcoalitionseats2=bswcoalitionseats2/100
replace bswcoalitionseats3=bswcoalitionseats3/100
replace bswcoalitionseats4=bswcoalitionseats4/100
replace bswcoalitionseats5=bswcoalitionseats5/100

replace dielinkecoalitionseats1=0 if dielinkecoalitionseats1==.
replace dielinkecoalitionseats2=0 if dielinkecoalitionseats2==.
replace dielinkecoalitionseats3=0 if dielinkecoalitionseats3==.
replace dielinkecoalitionseats4=0 if dielinkecoalitionseats4==.
replace dielinkecoalitionseats5=0 if dielinkecoalitionseats5==.

replace dielinkecoalitionseats1=dielinkecoalitionseats1/100
replace dielinkecoalitionseats2=dielinkecoalitionseats2/100
replace dielinkecoalitionseats3=dielinkecoalitionseats3/100
replace dielinkecoalitionseats4=dielinkecoalitionseats4/100
replace dielinkecoalitionseats5=dielinkecoalitionseats5/100

* Share of parliamentary seats of favorite party

gen fav_parlseats1=0
replace fav_parlseats1=cdupercentage1 if fav1==1
replace fav_parlseats1=afdpercentage1 if fav2==1
replace fav_parlseats1=spdpercentage1 if fav3==1
replace fav_parlseats1=grünepercentage1 if fav4==1
replace fav_parlseats1=fdppercentage1 if fav5==1
replace fav_parlseats1=bswpercentage1 if fav6==1
replace fav_parlseats1=dielinkepercentage1 if fav7==1
replace fav_parlseats1=. if tie_bis==0

gen fav_parlseats2=.
replace fav_parlseats2=cdupercentage2 if fav1==1
replace fav_parlseats2=afdpercentage2 if fav2==1
replace fav_parlseats2=spdpercentage2 if fav3==1
replace fav_parlseats2=grünepercentage2 if fav4==1
replace fav_parlseats2=fdppercentage2 if fav5==1
replace fav_parlseats2=bswpercentage2 if fav6==1
replace fav_parlseats2=dielinkepercentage2 if fav7==1
replace fav_parlseats2=. if tie_bis==0

gen fav_parlseats3=.
replace fav_parlseats3=cdupercentage3 if fav1==1
replace fav_parlseats3=afdpercentage3 if fav2==1
replace fav_parlseats3=spdpercentage3 if fav3==1
replace fav_parlseats3=grünepercentage3 if fav4==1
replace fav_parlseats3=fdppercentage3 if fav5==1
replace fav_parlseats3=bswpercentage3 if fav6==1
replace fav_parlseats3=dielinkepercentage3 if fav7==1
replace fav_parlseats3=. if tie_bis==0

gen fav_parlseats4=.
replace fav_parlseats4=cdupercentage4 if fav1==1
replace fav_parlseats4=afdpercentage4 if fav2==1
replace fav_parlseats4=spdpercentage4 if fav3==1
replace fav_parlseats4=grünepercentage4 if fav4==1
replace fav_parlseats4=fdppercentage4 if fav5==1
replace fav_parlseats4=bswpercentage4 if fav6==1
replace fav_parlseats4=dielinkepercentage4 if fav7==1
replace fav_parlseats4=. if tie_bis==0

gen fav_parlseats5=.
replace fav_parlseats5=cdupercentage5 if fav1==1
replace fav_parlseats5=afdpercentage5 if fav2==1
replace fav_parlseats5=spdpercentage5 if fav3==1
replace fav_parlseats5=grünepercentage5 if fav4==1
replace fav_parlseats5=fdppercentage5 if fav5==1
replace fav_parlseats5=bswpercentage5 if fav6==1
replace fav_parlseats5=dielinkepercentage5 if fav7==1
replace fav_parlseats5=. if tie_bis==0

* Share of parliamentary seats of most disliked party

gen least_parlseats1=.
replace least_parlseats1=cdupercentage1 if least1==1
replace least_parlseats1=afdpercentage1 if least2==1
replace least_parlseats1=spdpercentage1 if least3==1
replace least_parlseats1=grünepercentage1 if least4==1
replace least_parlseats1=fdppercentage1 if least5==1
replace least_parlseats1=bswpercentage1 if least6==1
replace least_parlseats1=dielinkepercentage1 if least7==1
replace least_parlseats1=. if tie2_bis==0

gen least_parlseats2=.
replace least_parlseats2=cdupercentage2 if least1==1
replace least_parlseats2=afdpercentage2 if least2==1
replace least_parlseats2=spdpercentage2 if least3==1
replace least_parlseats2=grünepercentage2 if least4==1
replace least_parlseats2=fdppercentage2 if least5==1
replace least_parlseats2=bswpercentage2 if least6==1
replace least_parlseats2=dielinkepercentage2 if least7==1
replace least_parlseats2=. if tie2_bis==0

gen least_parlseats3=.
replace least_parlseats3=cdupercentage3 if least1==1
replace least_parlseats3=afdpercentage3 if least2==1
replace least_parlseats3=spdpercentage3 if least3==1
replace least_parlseats3=grünepercentage3 if least4==1
replace least_parlseats3=fdppercentage3 if least5==1
replace least_parlseats3=bswpercentage3 if least6==1
replace least_parlseats3=dielinkepercentage3 if least7==1
replace least_parlseats3=. if tie2_bis==0

gen least_parlseats4=.
replace least_parlseats4=cdupercentage4 if least1==1
replace least_parlseats4=afdpercentage4 if least2==1
replace least_parlseats4=spdpercentage4 if least3==1
replace least_parlseats4=grünepercentage4 if least4==1
replace least_parlseats4=fdppercentage4 if least5==1
replace least_parlseats4=bswpercentage4 if least6==1
replace least_parlseats4=dielinkepercentage4 if least7==1
replace least_parlseats4=. if tie2_bis==0

gen least_parlseats5=.
replace least_parlseats5=cdupercentage5 if least1==1
replace least_parlseats5=afdpercentage5 if least2==1
replace least_parlseats5=spdpercentage5 if least3==1
replace least_parlseats5=grünepercentage5 if least4==1
replace least_parlseats5=fdppercentage5 if least5==1
replace least_parlseats5=bswpercentage5 if least6==1
replace least_parlseats5=dielinkepercentage5 if least7==1
replace least_parlseats5=. if tie2_bis==0

* Share of government seats of favorite party

gen fav_govseats1=0 
replace fav_govseats1=cducoalitionseats1 if fav1==1
replace fav_govseats1=afdcoalitionseats1 if fav2==1
replace fav_govseats1=spdcoalitionseats1 if fav3==1
replace fav_govseats1=grünecoalitionseats1 if fav4==1
replace fav_govseats1=fdpcoalitionseats1 if fav5==1
replace fav_govseats1=bswcoalitionseats1 if fav6==1
replace fav_govseats1=dielinkecoalitionseats1 if fav7==1
replace fav_govseats1=. if tie_bis==0

gen fav_govseats2=0
replace fav_govseats2=cducoalitionseats2 if fav1==1
replace fav_govseats2=afdcoalitionseats2 if fav2==1
replace fav_govseats2=spdcoalitionseats2 if fav3==1
replace fav_govseats2=grünecoalitionseats2 if fav4==1
replace fav_govseats2=fdpcoalitionseats2 if fav5==1
replace fav_govseats2=bswcoalitionseats2 if fav6==1
replace fav_govseats2=dielinkecoalitionseats2 if fav7==1
replace fav_govseats2=. if tie_bis==0

gen fav_govseats3=0
replace fav_govseats3=cducoalitionseats3 if fav1==1
replace fav_govseats3=afdcoalitionseats3 if fav2==1
replace fav_govseats3=spdcoalitionseats3 if fav3==1
replace fav_govseats3=grünecoalitionseats3 if fav4==1
replace fav_govseats3=fdpcoalitionseats3 if fav5==1
replace fav_govseats3=bswcoalitionseats3 if fav6==1
replace fav_govseats3=dielinkecoalitionseats3 if fav7==1
replace fav_govseats3=. if tie_bis==0

gen fav_govseats4=0
replace fav_govseats4=cducoalitionseats4 if fav1==1
replace fav_govseats4=afdcoalitionseats4 if fav2==1
replace fav_govseats4=spdcoalitionseats4 if fav3==1
replace fav_govseats4=grünecoalitionseats4 if fav4==1
replace fav_govseats4=fdpcoalitionseats4 if fav5==1
replace fav_govseats4=bswcoalitionseats4 if fav6==1
replace fav_govseats4=dielinkecoalitionseats4 if fav7==1
replace fav_govseats4=. if tie_bis==0

gen fav_govseats5=0
replace fav_govseats5=cducoalitionseats5 if fav1==1
replace fav_govseats5=afdcoalitionseats5 if fav2==1
replace fav_govseats5=spdcoalitionseats5 if fav3==1
replace fav_govseats5=grünecoalitionseats5 if fav4==1
replace fav_govseats5=fdpcoalitionseats5 if fav5==1
replace fav_govseats5=bswcoalitionseats5 if fav6==1
replace fav_govseats5=dielinkecoalitionseats5 if fav7==1
replace fav_govseats5=. if tie_bis==0

* Share of government seats of least liked party

gen least_govseats1=0
replace least_govseats1=cducoalitionseats1 if least1==1
replace least_govseats1=afdcoalitionseats1 if least2==1
replace least_govseats1=spdcoalitionseats1 if least3==1
replace least_govseats1=grünecoalitionseats1 if least4==1
replace least_govseats1=fdpcoalitionseats1 if least5==1
replace least_govseats1=bswcoalitionseats1 if least6==1
replace least_govseats1=dielinkecoalitionseats1 if least7==1
replace least_govseats1=. if tie2_bis==0

gen least_govseats2=0
replace least_govseats2=cducoalitionseats2 if least1==1
replace least_govseats2=afdcoalitionseats2 if least2==1
replace least_govseats2=spdcoalitionseats2 if least3==1
replace least_govseats2=grünecoalitionseats2 if least4==1
replace least_govseats2=fdpcoalitionseats2 if least5==1
replace least_govseats2=bswcoalitionseats2 if least6==1
replace least_govseats2=dielinkecoalitionseats2 if least7==1
replace least_govseats2=. if tie2_bis==0

gen least_govseats3=0
replace least_govseats3=cducoalitionseats3 if least1==1
replace least_govseats3=afdcoalitionseats3 if least2==1
replace least_govseats3=spdcoalitionseats3 if least3==1
replace least_govseats3=grünecoalitionseats3 if least4==1
replace least_govseats3=fdpcoalitionseats3 if least5==1
replace least_govseats3=bswcoalitionseats3 if least6==1
replace least_govseats3=dielinkecoalitionseats3 if least7==1
replace least_govseats3=. if tie2_bis==0

gen least_govseats4=0
replace least_govseats4=cducoalitionseats4 if least1==1
replace least_govseats4=afdcoalitionseats4 if least2==1
replace least_govseats4=spdcoalitionseats4 if least3==1
replace least_govseats4=grünecoalitionseats4 if least4==1
replace least_govseats4=fdpcoalitionseats4 if least5==1
replace least_govseats4=bswcoalitionseats4 if least6==1
replace least_govseats4=dielinkecoalitionseats4 if least7==1
replace least_govseats4=. if tie2_bis==0

gen least_govseats5=0
replace least_govseats5=cducoalitionseats5 if least1==1
replace least_govseats5=afdcoalitionseats5 if least2==1
replace least_govseats5=spdcoalitionseats5 if least3==1
replace least_govseats5=grünecoalitionseats5 if least4==1
replace least_govseats5=fdpcoalitionseats5 if least5==1
replace least_govseats5=bswcoalitionseats5 if least6==1
replace least_govseats5=dielinkecoalitionseats5 if least7==1
replace least_govseats5=. if tie2_bis==0

* Whether favorite party is chancellor

gen fav_chancellor1=0 
replace fav_chancellor1=1 if chancellorparty1=="CDU" & fav1==1
replace fav_chancellor1=1 if chancellorparty1=="AfD" & fav2==1
replace fav_chancellor1=1 if chancellorparty1=="SPD" & fav3==1
replace fav_chancellor1=1 if chancellorparty1=="Grüne" & fav4==1
replace fav_chancellor1=1 if chancellorparty1=="FDP" & fav5==1
replace fav_chancellor1=1 if chancellorparty1=="BSW" & fav6==1
replace fav_chancellor1=1 if chancellorparty1=="Die Linke" & fav7==1
replace fav_chancellor1=. if tie_bis==0

gen fav_chancellor2=0
replace fav_chancellor2=1 if chancellorparty2=="CDU" & fav1==1
replace fav_chancellor2=1 if chancellorparty2=="AfD" & fav2==1
replace fav_chancellor2=1 if chancellorparty2=="SPD" & fav3==1
replace fav_chancellor2=1 if chancellorparty2=="Grüne" & fav4==1
replace fav_chancellor2=1 if chancellorparty2=="FDP" & fav5==1
replace fav_chancellor2=1 if chancellorparty2=="BSW" & fav6==1
replace fav_chancellor2=1 if chancellorparty2=="Die Linke" & fav7==1
replace fav_chancellor2=. if tie_bis==0

gen fav_chancellor3=0
replace fav_chancellor3=1 if chancellorparty3=="CDU" & fav1==1
replace fav_chancellor3=1 if chancellorparty3=="AfD" & fav2==1
replace fav_chancellor3=1 if chancellorparty3=="SPD" & fav3==1
replace fav_chancellor3=1 if chancellorparty3=="Grüne" & fav4==1
replace fav_chancellor3=1 if chancellorparty3=="FDP" & fav5==1
replace fav_chancellor3=1 if chancellorparty3=="BSW" & fav6==1
replace fav_chancellor3=1 if chancellorparty3=="Die Linke" & fav7==1
replace fav_chancellor3=. if tie_bis==0

gen fav_chancellor4=0
replace fav_chancellor4=1 if chancellorparty4=="CDU" & fav1==1
replace fav_chancellor4=1 if chancellorparty4=="AfD" & fav2==1
replace fav_chancellor4=1 if chancellorparty4=="SPD" & fav3==1
replace fav_chancellor4=1 if chancellorparty4=="Grüne" & fav4==1
replace fav_chancellor4=1 if chancellorparty4=="FDP" & fav5==1
replace fav_chancellor4=1 if chancellorparty4=="BSW" & fav6==1
replace fav_chancellor4=1 if chancellorparty4=="Die Linke" & fav7==1
replace fav_chancellor4=. if tie_bis==0

gen fav_chancellor5=0
replace fav_chancellor5=1 if chancellorparty5=="CDU" & fav1==1
replace fav_chancellor5=1 if chancellorparty5=="AfD" & fav2==1
replace fav_chancellor5=1 if chancellorparty5=="SPD" & fav3==1
replace fav_chancellor5=1 if chancellorparty5=="Grüne" & fav4==1
replace fav_chancellor5=1 if chancellorparty5=="FDP" & fav5==1
replace fav_chancellor5=1 if chancellorparty5=="BSW" & fav6==1
replace fav_chancellor5=1 if chancellorparty5=="Die Linke" & fav7==1
replace fav_chancellor5=. if tie_bis==0

* Whether least liked party is chancellor

gen least_chancellor1=0
replace least_chancellor1=1 if chancellorparty1=="CDU" & least1==1
replace least_chancellor1=1 if chancellorparty1=="AfD" & least2==1
replace least_chancellor1=1 if chancellorparty1=="SPD" & least3==1
replace least_chancellor1=1 if chancellorparty1=="Grüne" & least4==1
replace least_chancellor1=1 if chancellorparty1=="FDP" & least5==1
replace least_chancellor1=1 if chancellorparty1=="BSW" & least6==1
replace least_chancellor1=1 if chancellorparty1=="Die Linke" & least7==1
replace least_chancellor1=. if tie2_bis==0

gen least_chancellor2=0
replace least_chancellor2=1 if chancellorparty2=="CDU" & least1==1
replace least_chancellor2=1 if chancellorparty2=="AfD" & least2==1
replace least_chancellor2=1 if chancellorparty2=="SPD" & least3==1
replace least_chancellor2=1 if chancellorparty2=="Grüne" & least4==1
replace least_chancellor2=1 if chancellorparty2=="FDP" & least5==1
replace least_chancellor2=1 if chancellorparty2=="BSW" & least6==1
replace least_chancellor2=1 if chancellorparty2=="Die Linke" & least7==1
replace least_chancellor2=. if tie2_bis==0


gen least_chancellor3=0
replace least_chancellor3=1 if chancellorparty3=="CDU" & least1==1
replace least_chancellor3=1 if chancellorparty3=="AfD" & least2==1
replace least_chancellor3=1 if chancellorparty3=="SPD" & least3==1
replace least_chancellor3=1 if chancellorparty3=="Grüne" & least4==1
replace least_chancellor3=1 if chancellorparty3=="FDP" & least5==1
replace least_chancellor3=1 if chancellorparty3=="BSW" & least6==1
replace least_chancellor3=1 if chancellorparty3=="Die Linke" & least7==1
replace least_chancellor3=. if tie2_bis==0


gen least_chancellor4=0
replace least_chancellor4=1 if chancellorparty4=="CDU" & least1==1
replace least_chancellor4=1 if chancellorparty4=="AfD" & least2==1
replace least_chancellor4=1 if chancellorparty4=="SPD" & least3==1
replace least_chancellor4=1 if chancellorparty4=="Grüne" & least4==1
replace least_chancellor4=1 if chancellorparty4=="FDP" & least5==1
replace least_chancellor4=1 if chancellorparty4=="BSW" & least6==1
replace least_chancellor4=1 if chancellorparty4=="Die Linke" & least7==1
replace least_chancellor4=. if tie2_bis==0


gen least_chancellor5=0
replace least_chancellor5=1 if chancellorparty5=="CDU" & least1==1
replace least_chancellor5=1 if chancellorparty5=="AfD" & least2==1
replace least_chancellor5=1 if chancellorparty5=="SPD" & least3==1
replace least_chancellor5=1 if chancellorparty5=="Grüne" & least4==1
replace least_chancellor5=1 if chancellorparty5=="FDP" & least5==1
replace least_chancellor5=1 if chancellorparty5=="BSW" & least6==1
replace least_chancellor5=1 if chancellorparty5=="Die Linke" & least7==1
replace least_chancellor5=. if tie2_bis==0

* Alternative measure of party liking and party performances
************************************************************

gen fav1_alt=0 // Most liked party
gen fav2_alt=0
gen fav3_alt=0
gen fav4_alt=0
gen fav5_alt=0
gen fav6_alt=0
gen fav7_alt=0

replace fav1_alt=1 if q12==1
replace fav2_alt=1 if q12==2
replace fav3_alt=1 if q12==3
replace fav4_alt=1 if q12==4
replace fav5_alt=1 if q12==5
replace fav6_alt=1 if q12==6
replace fav7_alt=1 if q12==7

gen least1_alt=0 // Most disliked party
gen least2_alt=0
gen least3_alt=0
gen least4_alt=0
gen least5_alt=0
gen least6_alt=0
gen least7_alt=0

replace least1_alt=1 if q13==1
replace least2_alt=1 if q13==2
replace least3_alt=1 if q13==3
replace least4_alt=1 if q13==4
replace least5_alt=1 if q13==5
replace least6_alt=1 if q13==6
replace least7_alt=1 if q13==7

* Share of parliamentary seats of favorite party

gen fav_alt_parlseats1=0
replace fav_alt_parlseats1=cdupercentage1 if fav1_alt==1
replace fav_alt_parlseats1=afdpercentage1 if fav2_alt==1
replace fav_alt_parlseats1=spdpercentage1 if fav3_alt==1
replace fav_alt_parlseats1=grünepercentage1 if fav4_alt==1
replace fav_alt_parlseats1=fdppercentage1 if fav5_alt==1
replace fav_alt_parlseats1=bswpercentage1 if fav6_alt==1
replace fav_alt_parlseats1=dielinkepercentage1 if fav7_alt==1
replace fav_alt_parlseats1=. if q12>7

gen fav_alt_parlseats2=.
replace fav_alt_parlseats2=cdupercentage2 if fav1_alt==1
replace fav_alt_parlseats2=afdpercentage2 if fav2_alt==1
replace fav_alt_parlseats2=spdpercentage2 if fav3_alt==1
replace fav_alt_parlseats2=grünepercentage2 if fav4_alt==1
replace fav_alt_parlseats2=fdppercentage2 if fav5_alt==1
replace fav_alt_parlseats2=bswpercentage2 if fav6_alt==1
replace fav_alt_parlseats2=dielinkepercentage2 if fav7_alt==1
replace fav_alt_parlseats2=. if q12>7

gen fav_alt_parlseats3=.
replace fav_alt_parlseats3=cdupercentage3 if fav1_alt==1
replace fav_alt_parlseats3=afdpercentage3 if fav2_alt==1
replace fav_alt_parlseats3=spdpercentage3 if fav3_alt==1
replace fav_alt_parlseats3=grünepercentage3 if fav4_alt==1
replace fav_alt_parlseats3=fdppercentage3 if fav5_alt==1
replace fav_alt_parlseats3=bswpercentage3 if fav6_alt==1
replace fav_alt_parlseats3=dielinkepercentage3 if fav7_alt==1
replace fav_alt_parlseats3=. if q12>7

gen fav_alt_parlseats4=.
replace fav_alt_parlseats4=cdupercentage4 if fav1_alt==1
replace fav_alt_parlseats4=afdpercentage4 if fav2_alt==1
replace fav_alt_parlseats4=spdpercentage4 if fav3_alt==1
replace fav_alt_parlseats4=grünepercentage4 if fav4_alt==1
replace fav_alt_parlseats4=fdppercentage4 if fav5_alt==1
replace fav_alt_parlseats4=bswpercentage4 if fav6_alt==1
replace fav_alt_parlseats4=dielinkepercentage4 if fav7_alt==1
replace fav_alt_parlseats4=. if q12>7

gen fav_alt_parlseats5=.
replace fav_alt_parlseats5=cdupercentage5 if fav1_alt==1
replace fav_alt_parlseats5=afdpercentage5 if fav2_alt==1
replace fav_alt_parlseats5=spdpercentage5 if fav3_alt==1
replace fav_alt_parlseats5=grünepercentage5 if fav4_alt==1
replace fav_alt_parlseats5=fdppercentage5 if fav5_alt==1
replace fav_alt_parlseats5=bswpercentage5 if fav6_alt==1
replace fav_alt_parlseats5=dielinkepercentage5 if fav7_alt==1
replace fav_alt_parlseats5=. if q12>7

* Share of parliamentary seats of most disliked party

gen least_alt_parlseats1=.
replace least_alt_parlseats1=cdupercentage1 if least1_alt==1
replace least_alt_parlseats1=afdpercentage1 if least2_alt==1
replace least_alt_parlseats1=spdpercentage1 if least3_alt==1
replace least_alt_parlseats1=grünepercentage1 if least4_alt==1
replace least_alt_parlseats1=fdppercentage1 if least5_alt==1
replace least_alt_parlseats1=bswpercentage1 if least6_alt==1
replace least_alt_parlseats1=dielinkepercentage1 if least7_alt==1
replace least_alt_parlseats1=. if q13>7

gen least_alt_parlseats2=.
replace least_alt_parlseats2=cdupercentage2 if least1_alt==1
replace least_alt_parlseats2=afdpercentage2 if least2_alt==1
replace least_alt_parlseats2=spdpercentage2 if least3_alt==1
replace least_alt_parlseats2=grünepercentage2 if least4_alt==1
replace least_alt_parlseats2=fdppercentage2 if least5_alt==1
replace least_alt_parlseats2=bswpercentage2 if least6_alt==1
replace least_alt_parlseats2=dielinkepercentage2 if least7_alt==1
replace least_alt_parlseats2=. if q13>7

gen least_alt_parlseats3=.
replace least_alt_parlseats3=cdupercentage3 if least1_alt==1
replace least_alt_parlseats3=afdpercentage3 if least2_alt==1
replace least_alt_parlseats3=spdpercentage3 if least3_alt==1
replace least_alt_parlseats3=grünepercentage3 if least4_alt==1
replace least_alt_parlseats3=fdppercentage3 if least5_alt==1
replace least_alt_parlseats3=bswpercentage3 if least6_alt==1
replace least_alt_parlseats3=dielinkepercentage3 if least7_alt==1
replace least_alt_parlseats3=. if q13>7

gen least_alt_parlseats4=.
replace least_alt_parlseats4=cdupercentage4 if least1_alt==1
replace least_alt_parlseats4=afdpercentage4 if least2_alt==1
replace least_alt_parlseats4=spdpercentage4 if least3_alt==1
replace least_alt_parlseats4=grünepercentage4 if least4_alt==1
replace least_alt_parlseats4=fdppercentage4 if least5_alt==1
replace least_alt_parlseats4=bswpercentage4 if least6_alt==1
replace least_alt_parlseats4=dielinkepercentage4 if least7_alt==1
replace least_alt_parlseats4=. if q13>7

gen least_alt_parlseats5=.
replace least_alt_parlseats5=cdupercentage5 if least1_alt==1
replace least_alt_parlseats5=afdpercentage5 if least2_alt==1
replace least_alt_parlseats5=spdpercentage5 if least3_alt==1
replace least_alt_parlseats5=grünepercentage5 if least4_alt==1
replace least_alt_parlseats5=fdppercentage5 if least5_alt==1
replace least_alt_parlseats5=bswpercentage5 if least6_alt==1
replace least_alt_parlseats5=dielinkepercentage5 if least7_alt==1
replace least_alt_parlseats5=. if q13>7

* Share of government seats of favorite party

gen fav_alt_govseats1=0 
replace fav_alt_govseats1=cducoalitionseats1 if fav1_alt==1
replace fav_alt_govseats1=afdcoalitionseats1 if fav2_alt==1
replace fav_alt_govseats1=spdcoalitionseats1 if fav3_alt==1
replace fav_alt_govseats1=grünecoalitionseats1 if fav4_alt==1
replace fav_alt_govseats1=fdpcoalitionseats1 if fav5_alt==1
replace fav_alt_govseats1=bswcoalitionseats1 if fav6_alt==1
replace fav_alt_govseats1=dielinkecoalitionseats1 if fav7_alt==1
replace fav_alt_govseats1=. if q12>7

gen fav_alt_govseats2=0
replace fav_alt_govseats2=cducoalitionseats2 if fav1_alt==1
replace fav_alt_govseats2=afdcoalitionseats2 if fav2_alt==1
replace fav_alt_govseats2=spdcoalitionseats2 if fav3_alt==1
replace fav_alt_govseats2=grünecoalitionseats2 if fav4_alt==1
replace fav_alt_govseats2=fdpcoalitionseats2 if fav5_alt==1
replace fav_alt_govseats2=bswcoalitionseats2 if fav6_alt==1
replace fav_alt_govseats2=dielinkecoalitionseats2 if fav7_alt==1
replace fav_alt_govseats2=. if q12>7

gen fav_alt_govseats3=0
replace fav_alt_govseats3=cducoalitionseats3 if fav1_alt==1
replace fav_alt_govseats3=afdcoalitionseats3 if fav2_alt==1
replace fav_alt_govseats3=spdcoalitionseats3 if fav3_alt==1
replace fav_alt_govseats3=grünecoalitionseats3 if fav4_alt==1
replace fav_alt_govseats3=fdpcoalitionseats3 if fav5_alt==1
replace fav_alt_govseats3=bswcoalitionseats3 if fav6_alt==1
replace fav_alt_govseats3=dielinkecoalitionseats3 if fav7_alt==1
replace fav_alt_govseats3=. if q12>7

gen fav_alt_govseats4=0
replace fav_alt_govseats4=cducoalitionseats4 if fav1_alt==1
replace fav_alt_govseats4=afdcoalitionseats4 if fav2_alt==1
replace fav_alt_govseats4=spdcoalitionseats4 if fav3_alt==1
replace fav_alt_govseats4=grünecoalitionseats4 if fav4_alt==1
replace fav_alt_govseats4=fdpcoalitionseats4 if fav5_alt==1
replace fav_alt_govseats4=bswcoalitionseats4 if fav6_alt==1
replace fav_alt_govseats4=dielinkecoalitionseats4 if fav7_alt==1
replace fav_alt_govseats4=. if q12>7

gen fav_alt_govseats5=0
replace fav_alt_govseats5=cducoalitionseats5 if fav1_alt==1
replace fav_alt_govseats5=afdcoalitionseats5 if fav2_alt==1
replace fav_alt_govseats5=spdcoalitionseats5 if fav3_alt==1
replace fav_alt_govseats5=grünecoalitionseats5 if fav4_alt==1
replace fav_alt_govseats5=fdpcoalitionseats5 if fav5_alt==1
replace fav_alt_govseats5=bswcoalitionseats5 if fav6==1
replace fav_alt_govseats5=dielinkecoalitionseats5 if fav7_alt==1
replace fav_alt_govseats5=. if q12>7

* Share of government seats of least liked party

gen least_alt_govseats1=0
replace least_alt_govseats1=cducoalitionseats1 if least1_alt==1
replace least_alt_govseats1=afdcoalitionseats1 if least2_alt==1
replace least_alt_govseats1=spdcoalitionseats1 if least3_alt==1
replace least_alt_govseats1=grünecoalitionseats1 if least4_alt==1
replace least_alt_govseats1=fdpcoalitionseats1 if least5_alt==1
replace least_alt_govseats1=bswcoalitionseats1 if least6_alt==1
replace least_alt_govseats1=dielinkecoalitionseats1 if least7_alt==1
replace least_alt_govseats1=. if q13>7

gen least_alt_govseats2=0
replace least_alt_govseats2=cducoalitionseats2 if least1_alt==1
replace least_alt_govseats2=afdcoalitionseats2 if least2_alt==1
replace least_alt_govseats2=spdcoalitionseats2 if least3_alt==1
replace least_alt_govseats2=grünecoalitionseats2 if least4_alt==1
replace least_alt_govseats2=fdpcoalitionseats2 if least5_alt==1
replace least_alt_govseats2=bswcoalitionseats2 if least6_alt==1
replace least_alt_govseats2=dielinkecoalitionseats2 if least7_alt==1
replace least_alt_govseats2=. if q13>7

gen least_alt_govseats3=0
replace least_alt_govseats3=cducoalitionseats3 if least1_alt==1
replace least_alt_govseats3=afdcoalitionseats3 if least2_alt==1
replace least_alt_govseats3=spdcoalitionseats3 if least3_alt==1
replace least_alt_govseats3=grünecoalitionseats3 if least4_alt==1
replace least_alt_govseats3=fdpcoalitionseats3 if least5_alt==1
replace least_alt_govseats3=bswcoalitionseats3 if least6_alt==1
replace least_alt_govseats3=dielinkecoalitionseats3 if least7_alt==1
replace least_alt_govseats3=. if q13>7

gen least_alt_govseats4=0
replace least_alt_govseats4=cducoalitionseats4 if least1_alt==1
replace least_alt_govseats4=afdcoalitionseats4 if least2_alt==1
replace least_alt_govseats4=spdcoalitionseats4 if least3_alt==1
replace least_alt_govseats4=grünecoalitionseats4 if least4_alt==1
replace least_alt_govseats4=fdpcoalitionseats4 if least5_alt==1
replace least_alt_govseats4=bswcoalitionseats4 if least6_alt==1
replace least_alt_govseats4=dielinkecoalitionseats4 if least7_alt==1
replace least_alt_govseats4=. if q13>7

gen least_alt_govseats5=0
replace least_alt_govseats5=cducoalitionseats5 if least1_alt==1
replace least_alt_govseats5=afdcoalitionseats5 if least2_alt==1
replace least_alt_govseats5=spdcoalitionseats5 if least3_alt==1
replace least_alt_govseats5=grünecoalitionseats5 if least4_alt==1
replace least_alt_govseats5=fdpcoalitionseats5 if least5_alt==1
replace least_alt_govseats5=bswcoalitionseats5 if least6_alt==1
replace least_alt_govseats5=dielinkecoalitionseats5 if least7_alt==1
replace least_alt_govseats5=. if q13>7

* Whether favorite party is chancellor

gen fav_alt_chancellor1=0 
replace fav_alt_chancellor1=1 if chancellorparty1=="CDU" & fav1_alt==1
replace fav_alt_chancellor1=1 if chancellorparty1=="AfD" & fav2_alt==1
replace fav_alt_chancellor1=1 if chancellorparty1=="SPD" & fav3_alt==1
replace fav_alt_chancellor1=1 if chancellorparty1=="Grüne" & fav4_alt==1
replace fav_alt_chancellor1=1 if chancellorparty1=="FDP" & fav5_alt==1
replace fav_alt_chancellor1=1 if chancellorparty1=="BSW" & fav6_alt==1
replace fav_alt_chancellor1=1 if chancellorparty1=="Die Linke" & fav7_alt==1
replace fav_alt_chancellor1=. if q12>7

gen fav_alt_chancellor2=0
replace fav_alt_chancellor2=1 if chancellorparty2=="CDU" & fav1_alt==1
replace fav_alt_chancellor2=1 if chancellorparty2=="AfD" & fav2_alt==1
replace fav_alt_chancellor2=1 if chancellorparty2=="SPD" & fav3_alt==1
replace fav_alt_chancellor2=1 if chancellorparty2=="Grüne" & fav4_alt==1
replace fav_alt_chancellor2=1 if chancellorparty2=="FDP" & fav5_alt==1
replace fav_alt_chancellor2=1 if chancellorparty2=="BSW" & fav6_alt==1
replace fav_alt_chancellor2=1 if chancellorparty2=="Die Linke" & fav7_alt==1
replace fav_alt_chancellor2=. if q12>7

gen fav_alt_chancellor3=0
replace fav_alt_chancellor3=1 if chancellorparty3=="CDU" & fav1_alt==1
replace fav_alt_chancellor3=1 if chancellorparty3=="AfD" & fav2_alt==1
replace fav_alt_chancellor3=1 if chancellorparty3=="SPD" & fav3_alt==1
replace fav_alt_chancellor3=1 if chancellorparty3=="Grüne" & fav4_alt==1
replace fav_alt_chancellor3=1 if chancellorparty3=="FDP" & fav5_alt==1
replace fav_alt_chancellor3=1 if chancellorparty3=="BSW" & fav6_alt==1
replace fav_alt_chancellor3=1 if chancellorparty3=="Die Linke" & fav7_alt==1
replace fav_alt_chancellor3=. if q12>7

gen fav_alt_chancellor4=0
replace fav_alt_chancellor4=1 if chancellorparty4=="CDU" & fav1_alt==1
replace fav_alt_chancellor4=1 if chancellorparty4=="AfD" & fav2_alt==1
replace fav_alt_chancellor4=1 if chancellorparty4=="SPD" & fav3_alt==1
replace fav_alt_chancellor4=1 if chancellorparty4=="Grüne" & fav4_alt==1
replace fav_alt_chancellor4=1 if chancellorparty4=="FDP" & fav5_alt==1
replace fav_alt_chancellor4=1 if chancellorparty4=="BSW" & fav6_alt==1
replace fav_alt_chancellor4=1 if chancellorparty4=="Die Linke" & fav7_alt==1
replace fav_alt_chancellor4=. if q12>7

gen fav_alt_chancellor5=0
replace fav_alt_chancellor5=1 if chancellorparty5=="CDU" & fav1_alt==1
replace fav_alt_chancellor5=1 if chancellorparty5=="AfD" & fav2_alt==1
replace fav_alt_chancellor5=1 if chancellorparty5=="SPD" & fav3_alt==1
replace fav_alt_chancellor5=1 if chancellorparty5=="Grüne" & fav4_alt==1
replace fav_alt_chancellor5=1 if chancellorparty5=="FDP" & fav5_alt==1
replace fav_alt_chancellor5=1 if chancellorparty5=="BSW" & fav6_alt==1
replace fav_alt_chancellor5=1 if chancellorparty5=="Die Linke" & fav7_alt==1
replace fav_alt_chancellor5=. if q12>7

* Whether least liked party is chancellor

gen least_alt_chancellor1=0
replace least_alt_chancellor1=1 if chancellorparty1=="CDU" & least1_alt==1
replace least_alt_chancellor1=1 if chancellorparty1=="AfD" & least2_alt==1
replace least_alt_chancellor1=1 if chancellorparty1=="SPD" & least3_alt==1
replace least_alt_chancellor1=1 if chancellorparty1=="Grüne" & least4_alt==1
replace least_alt_chancellor1=1 if chancellorparty1=="FDP" & least5_alt==1
replace least_alt_chancellor1=1 if chancellorparty1=="BSW" & least6_alt==1
replace least_alt_chancellor1=1 if chancellorparty1=="Die Linke" & least7_alt==1
replace least_alt_chancellor1=. if q13>7

gen least_alt_chancellor2=0
replace least_alt_chancellor2=1 if chancellorparty2=="CDU" & least1_alt==1
replace least_alt_chancellor2=1 if chancellorparty2=="AfD" & least2_alt==1
replace least_alt_chancellor2=1 if chancellorparty2=="SPD" & least3_alt==1
replace least_alt_chancellor2=1 if chancellorparty2=="Grüne" & least4_alt==1
replace least_alt_chancellor2=1 if chancellorparty2=="FDP" & least5_alt==1
replace least_alt_chancellor2=1 if chancellorparty2=="BSW" & least6_alt==1
replace least_alt_chancellor2=1 if chancellorparty2=="Die Linke" & least7_alt==1
replace least_alt_chancellor2=. if q13>7


gen least_alt_chancellor3=0
replace least_alt_chancellor3=1 if chancellorparty3=="CDU" & least1_alt==1
replace least_alt_chancellor3=1 if chancellorparty3=="AfD" & least2_alt==1
replace least_alt_chancellor3=1 if chancellorparty3=="SPD" & least3_alt==1
replace least_alt_chancellor3=1 if chancellorparty3=="Grüne" & least4_alt==1
replace least_alt_chancellor3=1 if chancellorparty3=="FDP" & least5_alt==1
replace least_alt_chancellor3=1 if chancellorparty3=="BSW" & least6_alt==1
replace least_alt_chancellor3=1 if chancellorparty3=="Die Linke" & least7_alt==1
replace least_alt_chancellor3=. if q13>7


gen least_alt_chancellor4=0
replace least_alt_chancellor4=1 if chancellorparty4=="CDU" & least1_alt==1
replace least_alt_chancellor4=1 if chancellorparty4=="AfD" & least2_alt==1
replace least_alt_chancellor4=1 if chancellorparty4=="SPD" & least3_alt==1
replace least_alt_chancellor4=1 if chancellorparty4=="Grüne" & least4_alt==1
replace least_alt_chancellor4=1 if chancellorparty4=="FDP" & least5_alt==1
replace least_alt_chancellor4=1 if chancellorparty4=="BSW" & least6_alt==1
replace least_alt_chancellor4=1 if chancellorparty4=="Die Linke" & least7_alt==1
replace least_alt_chancellor4=. if q13>7


gen least_alt_chancellor5=0
replace least_alt_chancellor5=1 if chancellorparty5=="CDU" & least1_alt==1
replace least_alt_chancellor5=1 if chancellorparty5=="AfD" & least2_alt==1
replace least_alt_chancellor5=1 if chancellorparty5=="SPD" & least3_alt==1
replace least_alt_chancellor5=1 if chancellorparty5=="Grüne" & least4_alt==1
replace least_alt_chancellor5=1 if chancellorparty5=="FDP" & least5_alt==1
replace least_alt_chancellor5=1 if chancellorparty5=="BSW" & least6_alt==1
replace least_alt_chancellor5=1 if chancellorparty5=="Die Linke" & least7_alt==1
replace least_alt_chancellor5=. if q13>7



* Creating structural variables
*******************************

* Effective number of parliamentary parties

gen cdupercentage1_sq=cdupercentage1*cdupercentage1
gen afdpercentage1_sq=afdpercentage1*afdpercentage1
gen spdpercentage1_sq=spdpercentage1*spdpercentage1
gen grünepercentage1_sq=grünepercentage1*grünepercentage1
gen fdppercentage1_sq=fdppercentage1*fdppercentage1
gen bswpercentage1_sq=bswpercentage1*bswpercentage1
gen dielinkepercentage1_sq=dielinkepercentage1*dielinkepercentage1

gen sum_parlseats1=cdupercentage1_sq+afdpercentage1_sq+spdpercentage1_sq+grünepercentage1_sq+fdppercentage1_sq+bswpercentage1_sq+dielinkepercentage1_sq

gen cdupercentage2_sq=cdupercentage2*cdupercentage2
gen afdpercentage2_sq=afdpercentage2*afdpercentage2
gen spdpercentage2_sq=spdpercentage2*spdpercentage2
gen grünepercentage2_sq=grünepercentage2*grünepercentage2
gen fdppercentage2_sq=fdppercentage2*fdppercentage2
gen bswpercentage2_sq=bswpercentage2*bswpercentage2
gen dielinkepercentage2_sq=dielinkepercentage2*dielinkepercentage2

gen sum_parlseats2=cdupercentage2_sq+afdpercentage2_sq+spdpercentage2_sq+grünepercentage2_sq+fdppercentage2_sq+bswpercentage2_sq+dielinkepercentage2_sq

gen cdupercentage3_sq=cdupercentage3*cdupercentage3
gen afdpercentage3_sq=afdpercentage3*afdpercentage3
gen spdpercentage3_sq=spdpercentage3*spdpercentage3
gen grünepercentage3_sq=grünepercentage3*grünepercentage3
gen fdppercentage3_sq=fdppercentage3*fdppercentage3
gen bswpercentage3_sq=bswpercentage3*bswpercentage3
gen dielinkepercentage3_sq=dielinkepercentage3*dielinkepercentage3

gen sum_parlseats3=cdupercentage3_sq+afdpercentage3_sq+spdpercentage3_sq+grünepercentage3_sq+fdppercentage3_sq+bswpercentage3_sq+dielinkepercentage3_sq

gen cdupercentage4_sq=cdupercentage4*cdupercentage4
gen afdpercentage4_sq=afdpercentage4*afdpercentage4
gen spdpercentage4_sq=spdpercentage4*spdpercentage4
gen grünepercentage4_sq=grünepercentage4*grünepercentage4
gen fdppercentage4_sq=fdppercentage4*fdppercentage4
gen bswpercentage4_sq=bswpercentage4*bswpercentage4
gen dielinkepercentage4_sq=dielinkepercentage4*dielinkepercentage4

gen sum_parlseats4=cdupercentage4_sq+afdpercentage4_sq+spdpercentage4_sq+grünepercentage4_sq+fdppercentage4_sq+bswpercentage4_sq+dielinkepercentage4_sq

gen cdupercentage5_sq=cdupercentage5*cdupercentage5
gen afdpercentage5_sq=afdpercentage5*afdpercentage5
gen spdpercentage5_sq=spdpercentage5*spdpercentage5
gen grünepercentage5_sq=grünepercentage5*grünepercentage5
gen fdppercentage5_sq=fdppercentage5*fdppercentage5
gen bswpercentage5_sq=bswpercentage5*bswpercentage5
gen dielinkepercentage5_sq=dielinkepercentage5*dielinkepercentage5

gen sum_parlseats5=cdupercentage5_sq+afdpercentage5_sq+spdpercentage5_sq+grünepercentage5_sq+fdppercentage5_sq+bswpercentage5_sq+dielinkepercentage5_sq

gen enpp1=1/sum_parlseats1
gen enpp2=1/sum_parlseats2
gen enpp3=1/sum_parlseats3
gen enpp4=1/sum_parlseats4
gen enpp5=1/sum_parlseats5

* Effective number of governing parties

gen cducoalitionseats1_sq=cducoalitionseats1*cducoalitionseats1
gen afdcoalitionseats1_sq=afdcoalitionseats1*afdcoalitionseats1
gen spdcoalitionseats1_sq=spdcoalitionseats1*spdcoalitionseats1
gen grünecoalitionseats1_sq=grünecoalitionseats1*grünecoalitionseats1
gen fdpcoalitionseats1_sq=fdpcoalitionseats1*fdpcoalitionseats1
gen bswcoalitionseats1_sq=bswcoalitionseats1*bswcoalitionseats1
gen dielinkecoalitionseats1_sq=dielinkecoalitionseats1*dielinkecoalitionseats1

gen sum_govseats1=cducoalitionseats1_sq+afdcoalitionseats1_sq+spdcoalitionseats1_sq+grünecoalitionseats1_sq+fdpcoalitionseats1_sq+bswcoalitionseats1_sq+dielinkecoalitionseats1_sq

gen cducoalitionseats2_sq=cducoalitionseats2*cducoalitionseats2
gen afdcoalitionseats2_sq=afdcoalitionseats2*afdcoalitionseats2
gen spdcoalitionseats2_sq=spdcoalitionseats2*spdcoalitionseats2
gen grünecoalitionseats2_sq=grünecoalitionseats2*grünecoalitionseats2
gen fdpcoalitionseats2_sq=fdpcoalitionseats2*fdpcoalitionseats2
gen bswcoalitionseats2_sq=bswcoalitionseats2*bswcoalitionseats2
gen dielinkecoalitionseats2_sq=dielinkecoalitionseats2*dielinkecoalitionseats2

gen sum_govseats2=cducoalitionseats2_sq+afdcoalitionseats2_sq+spdcoalitionseats2_sq+grünecoalitionseats2_sq+fdpcoalitionseats2_sq+bswcoalitionseats2_sq+dielinkecoalitionseats2_sq

gen cducoalitionseats3_sq=cducoalitionseats3*cducoalitionseats3
gen afdcoalitionseats3_sq=afdcoalitionseats3*afdcoalitionseats3
gen spdcoalitionseats3_sq=spdcoalitionseats3*spdcoalitionseats3
gen grünecoalitionseats3_sq=grünecoalitionseats3*grünecoalitionseats3
gen fdpcoalitionseats3_sq=fdpcoalitionseats3*fdpcoalitionseats3
gen bswcoalitionseats3_sq=bswcoalitionseats3*bswcoalitionseats3
gen dielinkecoalitionseats3_sq=dielinkecoalitionseats3*dielinkecoalitionseats3

gen sum_govseats3=cducoalitionseats3_sq+afdcoalitionseats3_sq+spdcoalitionseats3_sq+grünecoalitionseats3_sq+fdpcoalitionseats3_sq+bswcoalitionseats3_sq+dielinkecoalitionseats3_sq

gen cducoalitionseats4_sq=cducoalitionseats4*cducoalitionseats4
gen afdcoalitionseats4_sq=afdcoalitionseats4*afdcoalitionseats4
gen spdcoalitionseats4_sq=spdcoalitionseats4*spdcoalitionseats4
gen grünecoalitionseats4_sq=grünecoalitionseats4*grünecoalitionseats4
gen fdpcoalitionseats4_sq=fdpcoalitionseats4*fdpcoalitionseats4
gen bswcoalitionseats4_sq=bswcoalitionseats4*bswcoalitionseats4
gen dielinkecoalitionseats4_sq=dielinkecoalitionseats4*dielinkecoalitionseats4

gen sum_govseats4=cducoalitionseats4_sq+afdcoalitionseats4_sq+spdcoalitionseats4_sq+grünecoalitionseats4_sq+fdpcoalitionseats4_sq+bswcoalitionseats4_sq+dielinkecoalitionseats4_sq

gen cducoalitionseats5_sq=cducoalitionseats5*cducoalitionseats5
gen afdcoalitionseats5_sq=afdcoalitionseats5*afdcoalitionseats5
gen spdcoalitionseats5_sq=spdcoalitionseats5*spdcoalitionseats5
gen grünecoalitionseats5_sq=grünecoalitionseats5*grünecoalitionseats5
gen fdpcoalitionseats5_sq=fdpcoalitionseats5*fdpcoalitionseats5
gen bswcoalitionseats5_sq=bswcoalitionseats5*bswcoalitionseats5
gen dielinkecoalitionseats5_sq=dielinkecoalitionseats5*dielinkecoalitionseats5

gen sum_govseats5=cducoalitionseats5_sq+afdcoalitionseats5_sq+spdcoalitionseats5_sq+grünecoalitionseats5_sq+fdpcoalitionseats5_sq+bswcoalitionseats5_sq+dielinkecoalitionseats5_sq

gen enpg1=1/sum_govseats1
gen enpg2=1/sum_govseats2
gen enpg3=1/sum_govseats3
gen enpg4=1/sum_govseats4
gen enpg5=1/sum_govseats5

* Raw number of parties in government

gen number_parties_gov1=0
replace number_parties_gov1=number_parties_gov1+1 if cduincoalition1=="yes"
replace number_parties_gov1=number_parties_gov1+1 if afdincoalition1=="yes"
replace number_parties_gov1=number_parties_gov1+1 if spdincoalition1=="yes"
replace number_parties_gov1=number_parties_gov1+1 if grüneincoalition1=="yes"
replace number_parties_gov1=number_parties_gov1+1 if fdpincoalition1=="yes"
replace number_parties_gov1=number_parties_gov1+1 if bswincoalition1=="yes"
replace number_parties_gov1=number_parties_gov1+1 if dielinkeincoalition1=="yes"

gen number_parties_gov2=0
replace number_parties_gov2=number_parties_gov2+1 if cduincoalition2=="yes"
replace number_parties_gov2=number_parties_gov2+1 if afdincoalition2=="yes"
replace number_parties_gov2=number_parties_gov2+1 if spdincoalition2=="yes"
replace number_parties_gov2=number_parties_gov2+1 if grüneincoalition2=="yes"
replace number_parties_gov2=number_parties_gov2+1 if fdpincoalition2=="yes"
replace number_parties_gov2=number_parties_gov2+1 if bswincoalition2=="yes"
replace number_parties_gov2=number_parties_gov2+1 if dielinkeincoalition2=="yes"

gen number_parties_gov3=0
replace number_parties_gov3=number_parties_gov3+1 if cduincoalition3=="yes"
replace number_parties_gov3=number_parties_gov3+1 if afdincoalition3=="yes"
replace number_parties_gov3=number_parties_gov3+1 if spdincoalition3=="yes"
replace number_parties_gov3=number_parties_gov3+1 if grüneincoalition3=="yes"
replace number_parties_gov3=number_parties_gov3+1 if fdpincoalition3=="yes"
replace number_parties_gov3=number_parties_gov3+1 if bswincoalition3=="yes"
replace number_parties_gov3=number_parties_gov3+1 if dielinkeincoalition3=="yes"

gen number_parties_gov4=0
replace number_parties_gov4=number_parties_gov4+1 if cduincoalition4=="yes"
replace number_parties_gov4=number_parties_gov4+1 if afdincoalition4=="yes"
replace number_parties_gov4=number_parties_gov4+1 if spdincoalition4=="yes"
replace number_parties_gov4=number_parties_gov4+1 if grüneincoalition4=="yes"
replace number_parties_gov4=number_parties_gov4+1 if fdpincoalition4=="yes"
replace number_parties_gov4=number_parties_gov4+1 if bswincoalition4=="yes"
replace number_parties_gov4=number_parties_gov4+1 if dielinkeincoalition4=="yes"

gen number_parties_gov5=0
replace number_parties_gov5=number_parties_gov5+1 if cduincoalition5=="yes"
replace number_parties_gov5=number_parties_gov5+1 if afdincoalition5=="yes"
replace number_parties_gov5=number_parties_gov5+1 if spdincoalition5=="yes"
replace number_parties_gov5=number_parties_gov5+1 if grüneincoalition5=="yes"
replace number_parties_gov5=number_parties_gov5+1 if fdpincoalition5=="yes"
replace number_parties_gov5=number_parties_gov5+1 if bswincoalition5=="yes"
replace number_parties_gov5=number_parties_gov5+1 if dielinkeincoalition5=="yes"


* Raw number of parties in parliament

gen number_parties_parl1=0
replace number_parties_parl1=number_parties_parl1+1 if cdupercentage1>0
replace number_parties_parl1=number_parties_parl1+1 if afdpercentage1>0
replace number_parties_parl1=number_parties_parl1+1 if spdpercentage1>0
replace number_parties_parl1=number_parties_parl1+1 if grünepercentage1>0
replace number_parties_parl1=number_parties_parl1+1 if fdppercentage1>0
replace number_parties_parl1=number_parties_parl1+1 if bswpercentage1>0
replace number_parties_parl1=number_parties_parl1+1 if dielinkepercentage1>0

gen number_parties_parl2=0
replace number_parties_parl2=number_parties_parl2+1 if cdupercentage2>0
replace number_parties_parl2=number_parties_parl2+1 if afdpercentage2>0
replace number_parties_parl2=number_parties_parl2+1 if spdpercentage2>0
replace number_parties_parl2=number_parties_parl2+1 if grünepercentage2>0
replace number_parties_parl2=number_parties_parl2+1 if fdppercentage2>0
replace number_parties_parl2=number_parties_parl2+1 if bswpercentage2>0
replace number_parties_parl2=number_parties_parl2+1 if dielinkepercentage2>0

gen number_parties_parl3=0
replace number_parties_parl3=number_parties_parl3+1 if cdupercentage3>0
replace number_parties_parl3=number_parties_parl3+1 if afdpercentage3>0
replace number_parties_parl3=number_parties_parl3+1 if spdpercentage3>0
replace number_parties_parl3=number_parties_parl3+1 if grünepercentage3>0
replace number_parties_parl3=number_parties_parl3+1 if fdppercentage3>0
replace number_parties_parl3=number_parties_parl3+1 if bswpercentage3>0
replace number_parties_parl3=number_parties_parl3+1 if dielinkepercentage3>0

gen number_parties_parl4=0
replace number_parties_parl4=number_parties_parl4+1 if cdupercentage4>0
replace number_parties_parl4=number_parties_parl4+1 if afdpercentage4>0
replace number_parties_parl4=number_parties_parl4+1 if spdpercentage4>0
replace number_parties_parl4=number_parties_parl4+1 if grünepercentage4>0
replace number_parties_parl4=number_parties_parl4+1 if fdppercentage4>0
replace number_parties_parl4=number_parties_parl4+1 if bswpercentage4>0
replace number_parties_parl4=number_parties_parl4+1 if dielinkepercentage4>0

gen number_parties_parl5=0
replace number_parties_parl5=number_parties_parl5+1 if cdupercentage5>0
replace number_parties_parl5=number_parties_parl5+1 if afdpercentage5>0
replace number_parties_parl5=number_parties_parl5+1 if spdpercentage5>0
replace number_parties_parl5=number_parties_parl5+1 if grünepercentage5>0
replace number_parties_parl5=number_parties_parl5+1 if fdppercentage5>0
replace number_parties_parl5=number_parties_parl5+1 if bswpercentage5>0
replace number_parties_parl5=number_parties_parl5+1 if dielinkepercentage5>0


* Whether largest party in seats is in the coalition

gen max_percentage1=max(cdupercentage1, afdpercentage1, grünepercentage1, dielinkepercentage1, spdpercentage1, fdppercentage1, bswpercentage1)

gen largest_in_gov1=0
replace largest_in_gov1=1 if cdupercentage1==max_percentage1 & cduincoalition1=="yes"
replace largest_in_gov1=1 if afdpercentage1==max_percentage1 & afdincoalition1=="yes"
replace largest_in_gov1=1 if spdpercentage1==max_percentage1 & spdincoalition1=="yes"
replace largest_in_gov1=1 if grünepercentage1==max_percentage1 & grüneincoalition1=="yes"
replace largest_in_gov1=1 if fdppercentage1==max_percentage1 & fdpincoalition1=="yes"
replace largest_in_gov1=1 if bswpercentage1==max_percentage1 & bswincoalition1=="yes"
replace largest_in_gov1=1 if dielinkepercentage1==max_percentage1 & dielinkeincoalition1=="yes"

gen max_percentage2=max(cdupercentage2, afdpercentage2, grünepercentage2, dielinkepercentage2, spdpercentage2, fdppercentage2, bswpercentage2)

gen largest_in_gov2=0
replace largest_in_gov2=1 if cdupercentage2==max_percentage2 & cduincoalition2=="yes"
replace largest_in_gov2=1 if afdpercentage2==max_percentage2 & afdincoalition2=="yes"
replace largest_in_gov2=1 if spdpercentage2==max_percentage2 & spdincoalition2=="yes"
replace largest_in_gov2=1 if grünepercentage2==max_percentage2 & grüneincoalition2=="yes"
replace largest_in_gov2=1 if fdppercentage2==max_percentage2 & fdpincoalition2=="yes"
replace largest_in_gov2=1 if bswpercentage2==max_percentage2 & bswincoalition2=="yes"
replace largest_in_gov2=1 if dielinkepercentage2==max_percentage2 & dielinkeincoalition2=="yes"

gen max_percentage3=max(cdupercentage3, afdpercentage3, grünepercentage3, dielinkepercentage3, spdpercentage3, fdppercentage3, bswpercentage3)

gen largest_in_gov3=0
replace largest_in_gov3=1 if cdupercentage3==max_percentage3 & cduincoalition3=="yes"
replace largest_in_gov3=1 if afdpercentage3==max_percentage3 & afdincoalition3=="yes"
replace largest_in_gov3=1 if spdpercentage3==max_percentage3 & spdincoalition3=="yes"
replace largest_in_gov3=1 if grünepercentage3==max_percentage3 & grüneincoalition3=="yes"
replace largest_in_gov3=1 if fdppercentage3==max_percentage3 & fdpincoalition3=="yes"
replace largest_in_gov3=1 if bswpercentage3==max_percentage3 & bswincoalition3=="yes"
replace largest_in_gov3=1 if dielinkepercentage3==max_percentage3 & dielinkeincoalition3=="yes"

gen max_percentage4=max(cdupercentage4, afdpercentage4, grünepercentage4, dielinkepercentage4, spdpercentage4, fdppercentage4, bswpercentage4)

gen largest_in_gov4=0
replace largest_in_gov4=1 if cdupercentage4==max_percentage4 & cduincoalition4=="yes"
replace largest_in_gov4=1 if afdpercentage4==max_percentage4 & afdincoalition4=="yes"
replace largest_in_gov4=1 if spdpercentage4==max_percentage4 & spdincoalition4=="yes"
replace largest_in_gov4=1 if grünepercentage4==max_percentage4 & grüneincoalition4=="yes"
replace largest_in_gov4=1 if fdppercentage4==max_percentage4 & fdpincoalition4=="yes"
replace largest_in_gov4=1 if bswpercentage4==max_percentage4 & bswincoalition4=="yes"
replace largest_in_gov4=1 if dielinkepercentage4==max_percentage4 & dielinkeincoalition4=="yes"


gen max_percentage5=max(cdupercentage5, afdpercentage5, grünepercentage5, dielinkepercentage5, spdpercentage5, fdppercentage5, bswpercentage5)

gen largest_in_gov5=0
replace largest_in_gov5=1 if cdupercentage5==max_percentage5 & cduincoalition5=="yes"
replace largest_in_gov5=1 if afdpercentage5==max_percentage5 & afdincoalition5=="yes"
replace largest_in_gov5=1 if spdpercentage5==max_percentage5 & spdincoalition5=="yes"
replace largest_in_gov5=1 if grünepercentage5==max_percentage5 & grüneincoalition5=="yes"
replace largest_in_gov5=1 if fdppercentage5==max_percentage5 & fdpincoalition5=="yes"
replace largest_in_gov5=1 if bswpercentage5==max_percentage5 & bswincoalition5=="yes"
replace largest_in_gov5=1 if dielinkepercentage5==max_percentage5 & dielinkeincoalition5=="yes"


* Total votes of the coalition

replace totalvotescoalition1=totalvotescoalition/100


gen totalvotescoalition2=0
replace totalvotescoalition2=totalvotescoalition2+cdupercentage2 if cduincoalition2=="yes"
replace totalvotescoalition2=totalvotescoalition2+afdpercentage2 if afdincoalition2=="yes"
replace totalvotescoalition2=totalvotescoalition2+spdpercentage2 if spdincoalition2=="yes"
replace totalvotescoalition2=totalvotescoalition2+grünepercentage2 if grüneincoalition2=="yes"
replace totalvotescoalition2=totalvotescoalition2+fdppercentage2 if fdpincoalition2=="yes"
replace totalvotescoalition2=totalvotescoalition2+bswpercentage2 if bswincoalition2=="yes"
replace totalvotescoalition2=totalvotescoalition2+dielinkepercentage2 if dielinkeincoalition2=="yes"

gen totalvotescoalition3=0
replace totalvotescoalition3=totalvotescoalition3+cdupercentage3 if cduincoalition3=="yes"
replace totalvotescoalition3=totalvotescoalition3+afdpercentage3 if afdincoalition3=="yes"
replace totalvotescoalition3=totalvotescoalition3+spdpercentage3 if spdincoalition3=="yes"
replace totalvotescoalition3=totalvotescoalition3+grünepercentage3 if grüneincoalition3=="yes"
replace totalvotescoalition3=totalvotescoalition3+fdppercentage3 if fdpincoalition3=="yes"
replace totalvotescoalition3=totalvotescoalition3+bswpercentage3 if bswincoalition3=="yes"
replace totalvotescoalition3=totalvotescoalition3+dielinkepercentage3 if dielinkeincoalition3=="yes"

gen totalvotescoalition4=0
replace totalvotescoalition4=totalvotescoalition4+cdupercentage4 if cduincoalition4=="yes"
replace totalvotescoalition4=totalvotescoalition4+afdpercentage4 if afdincoalition4=="yes"
replace totalvotescoalition4=totalvotescoalition4+spdpercentage4 if spdincoalition4=="yes"
replace totalvotescoalition4=totalvotescoalition4+grünepercentage4 if grüneincoalition4=="yes"
replace totalvotescoalition4=totalvotescoalition4+fdppercentage4 if fdpincoalition4=="yes"
replace totalvotescoalition4=totalvotescoalition4+bswpercentage4 if bswincoalition4=="yes"
replace totalvotescoalition4=totalvotescoalition4+dielinkepercentage4 if dielinkeincoalition4=="yes"

gen totalvotescoalition5=0
replace totalvotescoalition5=totalvotescoalition5+cdupercentage5 if cduincoalition5=="yes"
replace totalvotescoalition5=totalvotescoalition5+afdpercentage5 if afdincoalition5=="yes"
replace totalvotescoalition5=totalvotescoalition5+spdpercentage5 if spdincoalition5=="yes"
replace totalvotescoalition5=totalvotescoalition5+grünepercentage5 if grüneincoalition5=="yes"
replace totalvotescoalition5=totalvotescoalition5+fdppercentage5 if fdpincoalition5=="yes"
replace totalvotescoalition5=totalvotescoalition5+bswpercentage5 if bswincoalition5=="yes"
replace totalvotescoalition5=totalvotescoalition5+dielinkepercentage5 if dielinkeincoalition5=="yes"

* Creating variables capturing performance of AfD specifically

gen afd_seats1=afdpercentage1
gen afd_seats2=afdpercentage2
gen afd_seats3=afdpercentage3
gen afd_seats4=afdpercentage4
gen afd_seats5=afdpercentage5

gen afd_govseats1=0
gen afd_govseats2=0
gen afd_govseats3=0
gen afd_govseats4=0
gen afd_govseats5=0

replace afd_govseats1=afdcoalitionseats1
replace afd_govseats2=afdcoalitionseats2
replace afd_govseats3=afdcoalitionseats3
replace afd_govseats4=afdcoalitionseats4
replace afd_govseats5=afdcoalitionseats5

gen afd_chancellor1=0
gen afd_chancellor2=0
gen afd_chancellor3=0
gen afd_chancellor4=0
gen afd_chancellor5=0

replace afd_chancellor1=1 if chancellorparty1=="AfD"
replace afd_chancellor2=1 if chancellorparty2=="AfD"
replace afd_chancellor3=1 if chancellorparty3=="AfD"
replace afd_chancellor4=1 if chancellorparty4=="AfD"
replace afd_chancellor5=1 if chancellorparty5=="AfD"

* Creating a variable that captures the frequency of coalitions since 1990

gen cdu_fdp=0.35 // Manually coding frequency of each coalition (as per ParlGov data)
gen cdu_spd=0.35
gen spd_grüne=0.21
gen spd_grüne_fdp=0.09

gen cdu_fdp1949=0.33 // Manually coding frequency of each coalition (as per ParlGov data)
gen cdu_spd1949=0.20
gen spd_fdp1949=0.17
gen spd_grüne1949=0.09
gen spd_grüne_fdp1949=0.04

gen frequency1=0
gen frequency2=0
gen frequency3=0
gen frequency4=0
gen frequency5=0

replace frequency1=cdu_fdp if cduincoalition1=="yes" & fdpincoalition1=="yes"
replace frequency1=cdu_spd if cduincoalition1=="yes" & spdincoalition1=="yes"
replace frequency1=spd_grüne if spdincoalition1=="yes" & grüneincoalition1=="yes"
replace frequency1=spd_grüne_fdp if spdincoalition1=="yes" & grüneincoalition1=="yes" & fdpincoalition1=="yes"

replace frequency2=cdu_fdp if cduincoalition2=="yes" & fdpincoalition2=="yes"
replace frequency2=cdu_spd if cduincoalition2=="yes" & spdincoalition2=="yes"
replace frequency2=spd_grüne if spdincoalition2=="yes" & grüneincoalition2=="yes"
replace frequency2=spd_grüne_fdp if spdincoalition2=="yes" & grüneincoalition2=="yes" & fdpincoalition2=="yes"

replace frequency3=cdu_fdp if cduincoalition3=="yes" & fdpincoalition3=="yes"
replace frequency3=cdu_spd if cduincoalition3=="yes" & spdincoalition3=="yes"
replace frequency3=spd_grüne if spdincoalition3=="yes" & grüneincoalition3=="yes"
replace frequency3=spd_grüne_fdp if spdincoalition3=="yes" & grüneincoalition3=="yes" & fdpincoalition3=="yes"

replace frequency4=cdu_fdp if cduincoalition4=="yes" & fdpincoalition4=="yes"
replace frequency4=cdu_spd if cduincoalition4=="yes" & spdincoalition4=="yes"
replace frequency4=spd_grüne if spdincoalition4=="yes" & grüneincoalition4=="yes"
replace frequency4=spd_grüne_fdp if spdincoalition4=="yes" & grüneincoalition4=="yes" & fdpincoalition4=="yes"

replace frequency5=cdu_fdp if cduincoalition5=="yes" & fdpincoalition5=="yes"
replace frequency5=cdu_spd if cduincoalition5=="yes" & spdincoalition5=="yes"
replace frequency5=spd_grüne if spdincoalition5=="yes" & grüneincoalition5=="yes"
replace frequency5=spd_grüne_fdp if spdincoalition5=="yes" & grüneincoalition5=="yes" & fdpincoalition5=="yes"


gen frequency1_1949=0
gen frequency2_1949=0
gen frequency3_1949=0
gen frequency4_1949=0
gen frequency5_1949=0

replace frequency1_1949=cdu_fdp1949 if cduincoalition1=="yes" & fdpincoalition1=="yes"
replace frequency1_1949=cdu_spd1949 if cduincoalition1=="yes" & spdincoalition1=="yes"
replace frequency1_1949=spd_fdp1949 if spdincoalition1=="yes" & fdpincoalition1=="yes"
replace frequency1_1949=spd_grüne1949 if spdincoalition1=="yes" & grüneincoalition1=="yes"
replace frequency1_1949=spd_grüne_fdp1949 if spdincoalition1=="yes" & grüneincoalition1=="yes" & fdpincoalition1=="yes"

replace frequency2_1949=cdu_fdp1949 if cduincoalition2=="yes" & fdpincoalition2=="yes"
replace frequency2_1949=cdu_spd1949 if cduincoalition2=="yes" & spdincoalition2=="yes"
replace frequency2_1949=spd_fdp1949 if spdincoalition2=="yes" & fdpincoalition2=="yes"
replace frequency2_1949=spd_grüne1949 if spdincoalition2=="yes" & grüneincoalition2=="yes"
replace frequency2_1949=spd_grüne_fdp1949 if spdincoalition2=="yes" & grüneincoalition2=="yes" & fdpincoalition2=="yes"

replace frequency3_1949=cdu_fdp1949 if cduincoalition3=="yes" & fdpincoalition3=="yes"
replace frequency3_1949=cdu_spd1949 if cduincoalition3=="yes" & spdincoalition3=="yes"
replace frequency3_1949=spd_fdp1949 if spdincoalition3=="yes" & fdpincoalition3=="yes"
replace frequency3_1949=spd_grüne1949 if spdincoalition3=="yes" & grüneincoalition3=="yes"
replace frequency3_1949=spd_grüne_fdp1949 if spdincoalition3=="yes" & grüneincoalition3=="yes" & fdpincoalition3=="yes"

replace frequency4_1949=cdu_fdp1949 if cduincoalition4=="yes" & fdpincoalition4=="yes"
replace frequency4_1949=cdu_spd1949 if cduincoalition4=="yes" & spdincoalition4=="yes"
replace frequency4_1949=spd_fdp1949 if spdincoalition4=="yes" & fdpincoalition4=="yes"
replace frequency4_1949=spd_grüne1949 if spdincoalition4=="yes" & grüneincoalition4=="yes"
replace frequency4_1949=spd_grüne_fdp1949 if spdincoalition4=="yes" & grüneincoalition4=="yes" & fdpincoalition4=="yes"

replace frequency5_1949=cdu_fdp1949 if cduincoalition5=="yes" & fdpincoalition5=="yes"
replace frequency5_1949=cdu_spd1949 if cduincoalition5=="yes" & spdincoalition5=="yes"
replace frequency5_1949=spd_fdp1949 if spdincoalition5=="yes" & fdpincoalition5=="yes"
replace frequency5_1949=spd_grüne1949 if spdincoalition5=="yes" & grüneincoalition5=="yes"
replace frequency5_1949=spd_grüne_fdp1949 if spdincoalition5=="yes" & grüneincoalition5=="yes" & fdpincoalition5=="yes"

* Creating a variable that captures polarization of the governing coalitions

gen chess_cdu=5.86  // Manually coding left-right position of each party (as per Chapel Hill Expert Survey)
gen chess_afd=9.24
gen chess_spd=3.62
gen chess_grüne=3.24
gen chess_fdp=6.43
gen chess_bsw=1.43
gen chess_dielinke=1.43

gen cmp_cdu=3.50 // Manually coding left-right position of each party (as Comparative Manifesto Project)
gen cmp_afd=26.05
gen cmp_spd=-24.67
gen cmp_grüne=-21.04
gen cmp_fdp=0.27
gen cmp_bsw=-36.17
gen cmp_dielinke=-36.17

gen chess_cdu_rile1=chess_cdu*cducoalitionseats1 // Calculating weighted left-right posiiton of each party in government
gen chess_afd_rile1=chess_afd*afdcoalitionseats1
gen chess_spd_rile1=chess_spd*spdcoalitionseats1
gen chess_grüne_rile1=chess_grüne*grünecoalitionseats1
gen chess_fdp_rile1=chess_fdp*fdpcoalitionseats1
gen chess_bsw_rile1=chess_bsw*bswcoalitionseats1
gen chess_dielinke_rile1=chess_dielinke*dielinkecoalitionseats1

gen gravity1=chess_cdu_rile1+chess_afd_rile1+chess_spd_rile1+chess_grüne_rile1+chess_fdp_rile1+chess_bsw_rile1+chess_dielinke_rile1 // Calculating center of gravity of the government

gen chess_cdu_rile_diff1=(chess_cdu-gravity1)/number_parties_gov1 // Calculating difference between left-right position and centre of gravity divided by number of parties in government
gen chess_afd_rile_diff1=(chess_afd-gravity1)/number_parties_gov1
gen chess_spd_rile_diff1=(chess_spd-gravity1)/number_parties_gov1
gen chess_grüne_rile_diff1=(chess_grüne-gravity1)/number_parties_gov1
gen chess_fdp_rile_diff1=(chess_fdp-gravity1)/number_parties_gov1
gen chess_bsw_rile_diff1=(chess_bsw-gravity1)/number_parties_gov1
gen chess_dielinke_rile_diff1=(chess_dielinke-gravity1)/number_parties_gov1

gen chess_cdu_rile_diff_sq1=(chess_cdu_rile_diff1^2)*cducoalitionseats1 // Calculating the square of the difference and multiple by the cabinet seats
gen chess_afd_rile_diff_sq1=(chess_afd_rile_diff1^2)*afdcoalitionseats1
gen chess_spd_rile_diff_sq1=(chess_spd_rile_diff1^2)*spdcoalitionseats1
gen chess_grüne_rile_diff_sq1=(chess_grüne_rile_diff1^2)*grünecoalitionseats1
gen chess_fdp_rile_diff_sq1=(chess_fdp_rile_diff1^2)*fdpcoalitionseats1
gen chess_bsw_rile_diff_sq1=(chess_bsw_rile_diff1^2)*bswcoalitionseats1
gen chess_dielinke_rile_diff_sq1=(chess_dielinke_rile_diff1^2)*dielinkecoalitionseats1

gen polarization_gov1=chess_cdu_rile_diff_sq1+chess_afd_rile_diff_sq1+chess_spd_rile_diff_sq1+chess_grüne_rile_diff_sq1+chess_fdp_rile_diff_sq1+chess_bsw_rile_diff_sq1+chess_dielinke_rile_diff_sq1

replace polarization_gov1=sqrt(polarization_gov1)

gen chess_cdu_rile2=chess_cdu*cducoalitionseats2
gen chess_afd_rile2=chess_afd*afdcoalitionseats2
gen chess_spd_rile2=chess_spd*spdcoalitionseats2
gen chess_grüne_rile2=chess_grüne*grünecoalitionseats2
gen chess_fdp_rile2=chess_fdp*fdpcoalitionseats2
gen chess_bsw_rile2=chess_bsw*bswcoalitionseats2
gen chess_dielinke_rile2=chess_dielinke*dielinkecoalitionseats2

gen gravity2=chess_cdu_rile2+chess_afd_rile2+chess_spd_rile2+chess_grüne_rile2+chess_fdp_rile2+chess_bsw_rile2+chess_dielinke_rile2

gen chess_cdu_rile_diff2=(chess_cdu-gravity2)/number_parties_gov2
gen chess_afd_rile_diff2=(chess_afd-gravity2)/number_parties_gov2
gen chess_spd_rile_diff2=(chess_spd-gravity2)/number_parties_gov2
gen chess_grüne_rile_diff2=(chess_grüne-gravity2)/number_parties_gov2
gen chess_fdp_rile_diff2=(chess_fdp-gravity2)/number_parties_gov2
gen chess_bsw_rile_diff2=(chess_bsw-gravity2)/number_parties_gov2
gen chess_dielinke_rile_diff2=(chess_dielinke-gravity2)/number_parties_gov2

gen chess_cdu_rile_diff_sq2=(chess_cdu_rile_diff2^2)*cducoalitionseats2
gen chess_afd_rile_diff_sq2=(chess_afd_rile_diff2^2)*afdcoalitionseats2
gen chess_spd_rile_diff_sq2=(chess_spd_rile_diff2^2)*spdcoalitionseats2
gen chess_grüne_rile_diff_sq2=(chess_grüne_rile_diff2^2)*grünecoalitionseats2
gen chess_fdp_rile_diff_sq2=(chess_fdp_rile_diff2^2)*fdpcoalitionseats2
gen chess_bsw_rile_diff_sq2=(chess_bsw_rile_diff2^2)*bswcoalitionseats2
gen chess_dielinke_rile_diff_sq2=(chess_dielinke_rile_diff2^2)*dielinkecoalitionseats2

gen polarization_gov2=chess_cdu_rile_diff_sq2+chess_afd_rile_diff_sq2+chess_spd_rile_diff_sq2+chess_grüne_rile_diff_sq2+chess_fdp_rile_diff_sq2+chess_bsw_rile_diff_sq2+chess_dielinke_rile_diff_sq2

replace polarization_gov2=sqrt(polarization_gov2)

gen chess_cdu_rile3=chess_cdu*cducoalitionseats3
gen chess_afd_rile3=chess_afd*afdcoalitionseats3
gen chess_spd_rile3=chess_spd*spdcoalitionseats3
gen chess_grüne_rile3=chess_grüne*grünecoalitionseats3
gen chess_fdp_rile3=chess_fdp*fdpcoalitionseats3
gen chess_bsw_rile3=chess_bsw*bswcoalitionseats3
gen chess_dielinke_rile3=chess_dielinke*dielinkecoalitionseats3

gen gravity3=chess_cdu_rile3+chess_afd_rile3+chess_spd_rile3+chess_grüne_rile3+chess_fdp_rile3+chess_bsw_rile3+chess_dielinke_rile3

gen chess_cdu_rile_diff3=(chess_cdu-gravity3)/number_parties_gov3
gen chess_afd_rile_diff3=(chess_afd-gravity3)/number_parties_gov3
gen chess_spd_rile_diff3=(chess_spd-gravity3)/number_parties_gov3
gen chess_grüne_rile_diff3=(chess_grüne-gravity3)/number_parties_gov3
gen chess_fdp_rile_diff3=(chess_fdp-gravity3)/number_parties_gov3
gen chess_bsw_rile_diff3=(chess_bsw-gravity3)/number_parties_gov3
gen chess_dielinke_rile_diff3=(chess_dielinke-gravity3)/number_parties_gov3

gen chess_cdu_rile_diff_sq3=(chess_cdu_rile_diff3^2)*cducoalitionseats3
gen chess_afd_rile_diff_sq3=(chess_afd_rile_diff3^2)*afdcoalitionseats3
gen chess_spd_rile_diff_sq3=(chess_spd_rile_diff3^2)*spdcoalitionseats3
gen chess_grüne_rile_diff_sq3=(chess_grüne_rile_diff3^2)*grünecoalitionseats3
gen chess_fdp_rile_diff_sq3=(chess_fdp_rile_diff3^2)*fdpcoalitionseats3
gen chess_bsw_rile_diff_sq3=(chess_bsw_rile_diff3^2)*bswcoalitionseats3
gen chess_dielinke_rile_diff_sq3=(chess_dielinke_rile_diff3^2)*dielinkecoalitionseats3

gen polarization_gov3=chess_cdu_rile_diff_sq3+chess_afd_rile_diff_sq3+chess_spd_rile_diff_sq3+chess_grüne_rile_diff_sq3+chess_fdp_rile_diff_sq3+chess_bsw_rile_diff_sq3+chess_dielinke_rile_diff_sq3

replace polarization_gov3=sqrt(polarization_gov3)

gen chess_cdu_rile4=chess_cdu*cducoalitionseats4
gen chess_afd_rile4=chess_afd*afdcoalitionseats4
gen chess_spd_rile4=chess_spd*spdcoalitionseats4
gen chess_grüne_rile4=chess_grüne*grünecoalitionseats4
gen chess_fdp_rile4=chess_fdp*fdpcoalitionseats4
gen chess_bsw_rile4=chess_bsw*bswcoalitionseats4
gen chess_dielinke_rile4=chess_dielinke*dielinkecoalitionseats4

gen gravity4=chess_cdu_rile4+chess_afd_rile4+chess_spd_rile4+chess_grüne_rile4+chess_fdp_rile4+chess_bsw_rile4+chess_dielinke_rile4

gen chess_cdu_rile_diff4=(chess_cdu-gravity4)/number_parties_gov4
gen chess_afd_rile_diff4=(chess_afd-gravity4)/number_parties_gov4
gen chess_spd_rile_diff4=(chess_spd-gravity4)/number_parties_gov4
gen chess_grüne_rile_diff4=(chess_grüne-gravity4)/number_parties_gov4
gen chess_fdp_rile_diff4=(chess_fdp-gravity4)/number_parties_gov4
gen chess_bsw_rile_diff4=(chess_bsw-gravity4)/number_parties_gov4
gen chess_dielinke_rile_diff4=(chess_dielinke-gravity4)/number_parties_gov4

gen chess_cdu_rile_diff_sq4=(chess_cdu_rile_diff4^2)*cducoalitionseats4
gen chess_afd_rile_diff_sq4=(chess_afd_rile_diff4^2)*afdcoalitionseats4
gen chess_spd_rile_diff_sq4=(chess_spd_rile_diff4^2)*spdcoalitionseats4
gen chess_grüne_rile_diff_sq4=(chess_grüne_rile_diff4^2)*grünecoalitionseats4
gen chess_fdp_rile_diff_sq4=(chess_fdp_rile_diff4^2)*fdpcoalitionseats4
gen chess_bsw_rile_diff_sq4=(chess_bsw_rile_diff4^2)*bswcoalitionseats4
gen chess_dielinke_rile_diff_sq4=(chess_dielinke_rile_diff4^2)*dielinkecoalitionseats4

gen polarization_gov4=chess_cdu_rile_diff_sq4+chess_afd_rile_diff_sq4+chess_spd_rile_diff_sq4+chess_grüne_rile_diff_sq4+chess_fdp_rile_diff_sq4+chess_bsw_rile_diff_sq4+chess_dielinke_rile_diff_sq4

replace polarization_gov4=sqrt(polarization_gov4)

gen chess_cdu_rile5=chess_cdu*cducoalitionseats5
gen chess_afd_rile5=chess_afd*afdcoalitionseats5
gen chess_spd_rile5=chess_spd*spdcoalitionseats5
gen chess_grüne_rile5=chess_grüne*grünecoalitionseats5
gen chess_fdp_rile5=chess_fdp*fdpcoalitionseats5
gen chess_bsw_rile5=chess_bsw*bswcoalitionseats5
gen chess_dielinke_rile5=chess_dielinke*dielinkecoalitionseats5

gen gravity5=chess_cdu_rile5+chess_afd_rile5+chess_spd_rile5+chess_grüne_rile5+chess_fdp_rile5+chess_bsw_rile5+chess_dielinke_rile5

gen chess_cdu_rile_diff5=(chess_cdu-gravity5)/number_parties_gov5
gen chess_afd_rile_diff5=(chess_afd-gravity5)/number_parties_gov5
gen chess_spd_rile_diff5=(chess_spd-gravity5)/number_parties_gov5
gen chess_grüne_rile_diff5=(chess_grüne-gravity5)/number_parties_gov5
gen chess_fdp_rile_diff5=(chess_fdp-gravity5)/number_parties_gov5
gen chess_bsw_rile_diff5=(chess_bsw-gravity5)/number_parties_gov5
gen chess_dielinke_rile_diff5=(chess_dielinke-gravity5)/number_parties_gov5

gen chess_cdu_rile_diff_sq5=(chess_cdu_rile_diff5^2)*cducoalitionseats5
gen chess_afd_rile_diff_sq5=(chess_afd_rile_diff5^2)*afdcoalitionseats5
gen chess_spd_rile_diff_sq5=(chess_spd_rile_diff5^2)*spdcoalitionseats5
gen chess_grüne_rile_diff_sq5=(chess_grüne_rile_diff5^2)*grünecoalitionseats5
gen chess_fdp_rile_diff_sq5=(chess_fdp_rile_diff5^2)*fdpcoalitionseats5
gen chess_bsw_rile_diff_sq5=(chess_bsw_rile_diff5^2)*bswcoalitionseats5
gen chess_dielinke_rile_diff_sq5=(chess_dielinke_rile_diff5^2)*dielinkecoalitionseats5

gen polarization_gov5=chess_cdu_rile_diff_sq5+chess_afd_rile_diff_sq5+chess_spd_rile_diff_sq5+chess_grüne_rile_diff_sq5+chess_fdp_rile_diff_sq5+chess_bsw_rile_diff_sq5+chess_dielinke_rile_diff_sq5

replace polarization_gov5=sqrt(polarization_gov5)

gen cmp_cdu_rile1=cmp_cdu*cducoalitionseats1 // Same thing but with CMP data
gen cmp_afd_rile1=cmp_afd*afdcoalitionseats1
gen cmp_spd_rile1=cmp_spd*spdcoalitionseats1
gen cmp_grüne_rile1=cmp_grüne*grünecoalitionseats1
gen cmp_fdp_rile1=cmp_fdp*fdpcoalitionseats1
gen cmp_bsw_rile1=cmp_bsw*bswcoalitionseats1
gen cmp_dielinke_rile1=cmp_dielinke*dielinkecoalitionseats1

gen cmp_gravity1=cmp_cdu_rile1+cmp_afd_rile1+cmp_spd_rile1+cmp_grüne_rile1+cmp_fdp_rile1+cmp_bsw_rile1+cmp_dielinke_rile1

gen cmp_cdu_rile_diff1=(cmp_cdu-cmp_gravity1)/number_parties_gov1
gen cmp_afd_rile_diff1=(cmp_afd-cmp_gravity1)/number_parties_gov1
gen cmp_spd_rile_diff1=(cmp_spd-cmp_gravity1)/number_parties_gov1
gen cmp_grüne_rile_diff1=(cmp_grüne-cmp_gravity1)/number_parties_gov1
gen cmp_fdp_rile_diff1=(cmp_fdp-cmp_gravity1)/number_parties_gov1
gen cmp_bsw_rile_diff1=(cmp_bsw-cmp_gravity1)/number_parties_gov1
gen cmp_dielinke_rile_diff1=(cmp_dielinke-cmp_gravity1)/number_parties_gov1

gen cmp_cdu_rile_diff_sq1=(cmp_cdu_rile_diff1^2)*cducoalitionseats1
gen cmp_afd_rile_diff_sq1=(cmp_afd_rile_diff1^2)*afdcoalitionseats1
gen cmp_spd_rile_diff_sq1=(cmp_spd_rile_diff1^2)*spdcoalitionseats1
gen cmp_grüne_rile_diff_sq1=(cmp_grüne_rile_diff1^2)*grünecoalitionseats1
gen cmp_fdp_rile_diff_sq1=(cmp_fdp_rile_diff1^2)*fdpcoalitionseats1
gen cmp_bsw_rile_diff_sq1=(cmp_bsw_rile_diff1^2)*bswcoalitionseats1
gen cmp_dielinke_rile_diff_sq1=(cmp_dielinke_rile_diff1^2)*dielinkecoalitionseats1

gen cmp_polarization_gov1=cmp_cdu_rile_diff_sq1+cmp_afd_rile_diff_sq1+cmp_spd_rile_diff_sq1+cmp_grüne_rile_diff_sq1+cmp_fdp_rile_diff_sq1+cmp_bsw_rile_diff_sq1+cmp_dielinke_rile_diff_sq1

replace cmp_polarization_gov1=sqrt(cmp_polarization_gov1)

gen cmp_cdu_rile2=cmp_cdu*cducoalitionseats2
gen cmp_afd_rile2=cmp_afd*afdcoalitionseats2
gen cmp_spd_rile2=cmp_spd*spdcoalitionseats2
gen cmp_grüne_rile2=cmp_grüne*grünecoalitionseats2
gen cmp_fdp_rile2=cmp_fdp*fdpcoalitionseats2
gen cmp_bsw_rile2=cmp_bsw*bswcoalitionseats2
gen cmp_dielinke_rile2=cmp_dielinke*dielinkecoalitionseats2

gen cmp_gravity2=cmp_cdu_rile2+cmp_afd_rile2+cmp_spd_rile2+cmp_grüne_rile2+cmp_fdp_rile2+cmp_bsw_rile2+cmp_dielinke_rile2

gen cmp_cdu_rile_diff2=(cmp_cdu-cmp_gravity2)/number_parties_gov2
gen cmp_afd_rile_diff2=(cmp_afd-cmp_gravity2)/number_parties_gov2
gen cmp_spd_rile_diff2=(cmp_spd-cmp_gravity2)/number_parties_gov2
gen cmp_grüne_rile_diff2=(cmp_grüne-cmp_gravity2)/number_parties_gov2
gen cmp_fdp_rile_diff2=(cmp_fdp-cmp_gravity2)/number_parties_gov2
gen cmp_bsw_rile_diff2=(cmp_bsw-cmp_gravity2)/number_parties_gov2
gen cmp_dielinke_rile_diff2=(cmp_dielinke-cmp_gravity2)/number_parties_gov2

gen cmp_cdu_rile_diff_sq2=(cmp_cdu_rile_diff2^2)*cducoalitionseats2
gen cmp_afd_rile_diff_sq2=(cmp_afd_rile_diff2^2)*afdcoalitionseats2
gen cmp_spd_rile_diff_sq2=(cmp_spd_rile_diff2^2)*spdcoalitionseats2
gen cmp_grüne_rile_diff_sq2=(cmp_grüne_rile_diff2^2)*grünecoalitionseats2
gen cmp_fdp_rile_diff_sq2=(cmp_fdp_rile_diff2^2)*fdpcoalitionseats2
gen cmp_bsw_rile_diff_sq2=(cmp_bsw_rile_diff2^2)*bswcoalitionseats2
gen cmp_dielinke_rile_diff_sq2=(cmp_dielinke_rile_diff2^2)*dielinkecoalitionseats2

gen cmp_polarization_gov2=cmp_cdu_rile_diff_sq2+cmp_afd_rile_diff_sq2+cmp_spd_rile_diff_sq2+cmp_grüne_rile_diff_sq2+cmp_fdp_rile_diff_sq2+cmp_bsw_rile_diff_sq2+cmp_dielinke_rile_diff_sq2

replace cmp_polarization_gov2=sqrt(cmp_polarization_gov2)

gen cmp_cdu_rile3=cmp_cdu*cducoalitionseats3
gen cmp_afd_rile3=cmp_afd*afdcoalitionseats3
gen cmp_spd_rile3=cmp_spd*spdcoalitionseats3
gen cmp_grüne_rile3=cmp_grüne*grünecoalitionseats3
gen cmp_fdp_rile3=cmp_fdp*fdpcoalitionseats3
gen cmp_bsw_rile3=cmp_bsw*bswcoalitionseats3
gen cmp_dielinke_rile3=cmp_dielinke*dielinkecoalitionseats3

gen cmp_gravity3=cmp_cdu_rile3+cmp_afd_rile3+cmp_spd_rile3+cmp_grüne_rile3+cmp_fdp_rile3+cmp_bsw_rile3+cmp_dielinke_rile3

gen cmp_cdu_rile_diff3=(cmp_cdu-cmp_gravity3)/number_parties_gov3
gen cmp_afd_rile_diff3=(cmp_afd-cmp_gravity3)/number_parties_gov3
gen cmp_spd_rile_diff3=(cmp_spd-cmp_gravity3)/number_parties_gov3
gen cmp_grüne_rile_diff3=(cmp_grüne-cmp_gravity3)/number_parties_gov3
gen cmp_fdp_rile_diff3=(cmp_fdp-cmp_gravity3)/number_parties_gov3
gen cmp_bsw_rile_diff3=(cmp_bsw-cmp_gravity3)/number_parties_gov3
gen cmp_dielinke_rile_diff3=(cmp_dielinke-cmp_gravity3)/number_parties_gov3

gen cmp_cdu_rile_diff_sq3=(cmp_cdu_rile_diff3^2)*cducoalitionseats3
gen cmp_afd_rile_diff_sq3=(cmp_afd_rile_diff3^2)*afdcoalitionseats3
gen cmp_spd_rile_diff_sq3=(cmp_spd_rile_diff3^2)*spdcoalitionseats3
gen cmp_grüne_rile_diff_sq3=(cmp_grüne_rile_diff3^2)*grünecoalitionseats3
gen cmp_fdp_rile_diff_sq3=(cmp_fdp_rile_diff3^2)*fdpcoalitionseats3
gen cmp_bsw_rile_diff_sq3=(cmp_bsw_rile_diff3^2)*bswcoalitionseats3
gen cmp_dielinke_rile_diff_sq3=(cmp_dielinke_rile_diff3^2)*dielinkecoalitionseats3

gen cmp_polarization_gov3=cmp_cdu_rile_diff_sq3+cmp_afd_rile_diff_sq3+cmp_spd_rile_diff_sq3+cmp_grüne_rile_diff_sq3+cmp_fdp_rile_diff_sq3+cmp_bsw_rile_diff_sq3+cmp_dielinke_rile_diff_sq3

replace cmp_polarization_gov3=sqrt(cmp_polarization_gov3)

gen cmp_cdu_rile4=cmp_cdu*cducoalitionseats4
gen cmp_afd_rile4=cmp_afd*afdcoalitionseats4
gen cmp_spd_rile4=cmp_spd*spdcoalitionseats4
gen cmp_grüne_rile4=cmp_grüne*grünecoalitionseats4
gen cmp_fdp_rile4=cmp_fdp*fdpcoalitionseats4
gen cmp_bsw_rile4=cmp_bsw*bswcoalitionseats4
gen cmp_dielinke_rile4=cmp_dielinke*dielinkecoalitionseats4

gen cmp_gravity4=cmp_cdu_rile4+cmp_afd_rile4+cmp_spd_rile4+cmp_grüne_rile4+cmp_fdp_rile4+cmp_bsw_rile4+cmp_dielinke_rile4

gen cmp_cdu_rile_diff4=(cmp_cdu-cmp_gravity4)/number_parties_gov4
gen cmp_afd_rile_diff4=(cmp_afd-cmp_gravity4)/number_parties_gov4
gen cmp_spd_rile_diff4=(cmp_spd-cmp_gravity4)/number_parties_gov4
gen cmp_grüne_rile_diff4=(cmp_grüne-cmp_gravity4)/number_parties_gov4
gen cmp_fdp_rile_diff4=(cmp_fdp-cmp_gravity4)/number_parties_gov4
gen cmp_bsw_rile_diff4=(cmp_bsw-cmp_gravity4)/number_parties_gov4
gen cmp_dielinke_rile_diff4=(cmp_dielinke-cmp_gravity4)/number_parties_gov4

gen cmp_cdu_rile_diff_sq4=(cmp_cdu_rile_diff4^2)*cducoalitionseats4
gen cmp_afd_rile_diff_sq4=(cmp_afd_rile_diff4^2)*afdcoalitionseats4
gen cmp_spd_rile_diff_sq4=(cmp_spd_rile_diff4^2)*spdcoalitionseats4
gen cmp_grüne_rile_diff_sq4=(cmp_grüne_rile_diff4^2)*grünecoalitionseats4
gen cmp_fdp_rile_diff_sq4=(cmp_fdp_rile_diff4^2)*fdpcoalitionseats4
gen cmp_bsw_rile_diff_sq4=(cmp_bsw_rile_diff4^2)*bswcoalitionseats4
gen cmp_dielinke_rile_diff_sq4=(cmp_dielinke_rile_diff4^2)*dielinkecoalitionseats4

gen cmp_polarization_gov4=cmp_cdu_rile_diff_sq4+cmp_afd_rile_diff_sq4+cmp_spd_rile_diff_sq4+cmp_grüne_rile_diff_sq4+cmp_fdp_rile_diff_sq4+cmp_bsw_rile_diff_sq4+cmp_dielinke_rile_diff_sq4

replace cmp_polarization_gov4=sqrt(cmp_polarization_gov4)

gen cmp_cdu_rile5=cmp_cdu*cducoalitionseats5
gen cmp_afd_rile5=cmp_afd*afdcoalitionseats5
gen cmp_spd_rile5=cmp_spd*spdcoalitionseats5
gen cmp_grüne_rile5=cmp_grüne*grünecoalitionseats5
gen cmp_fdp_rile5=cmp_fdp*fdpcoalitionseats5
gen cmp_bsw_rile5=cmp_bsw*bswcoalitionseats5
gen cmp_dielinke_rile5=cmp_dielinke*dielinkecoalitionseats5

gen cmp_gravity5=cmp_cdu_rile5+cmp_afd_rile5+cmp_spd_rile5+cmp_grüne_rile5+cmp_fdp_rile5+cmp_bsw_rile5+cmp_dielinke_rile5

gen cmp_cdu_rile_diff5=(cmp_cdu-cmp_gravity5)/number_parties_gov5
gen cmp_afd_rile_diff5=(cmp_afd-cmp_gravity5)/number_parties_gov5
gen cmp_spd_rile_diff5=(cmp_spd-cmp_gravity5)/number_parties_gov5
gen cmp_grüne_rile_diff5=(cmp_grüne-cmp_gravity5)/number_parties_gov5
gen cmp_fdp_rile_diff5=(cmp_fdp-cmp_gravity5)/number_parties_gov5
gen cmp_bsw_rile_diff5=(cmp_bsw-cmp_gravity5)/number_parties_gov5
gen cmp_dielinke_rile_diff5=(cmp_dielinke-cmp_gravity5)/number_parties_gov5

gen cmp_cdu_rile_diff_sq5=(cmp_cdu_rile_diff5^2)*cducoalitionseats5
gen cmp_afd_rile_diff_sq5=(cmp_afd_rile_diff5^2)*afdcoalitionseats5
gen cmp_spd_rile_diff_sq5=(cmp_spd_rile_diff5^2)*spdcoalitionseats5
gen cmp_grüne_rile_diff_sq5=(cmp_grüne_rile_diff5^2)*grünecoalitionseats5
gen cmp_fdp_rile_diff_sq5=(cmp_fdp_rile_diff5^2)*fdpcoalitionseats5
gen cmp_bsw_rile_diff_sq5=(cmp_bsw_rile_diff5^2)*bswcoalitionseats5
gen cmp_dielinke_rile_diff_sq5=(cmp_dielinke_rile_diff5^2)*dielinkecoalitionseats5

gen cmp_polarization_gov5=cmp_cdu_rile_diff_sq5+cmp_afd_rile_diff_sq5+cmp_spd_rile_diff_sq5+cmp_grüne_rile_diff_sq5+cmp_fdp_rile_diff_sq5+cmp_bsw_rile_diff_sq5+cmp_dielinke_rile_diff_sq5

replace cmp_polarization_gov5=sqrt(cmp_polarization_gov5)

* Creating a variable identifying parties in coalition, parties in Chancellor and parties with seats

gen cdu_parl1=0
gen cdu_parl2=0
gen cdu_parl3=0
gen cdu_parl4=0
gen cdu_parl5=0

replace cdu_parl1=cdupercentage1
replace cdu_parl2=cdupercentage2
replace cdu_parl3=cdupercentage3
replace cdu_parl4=cdupercentage4
replace cdu_parl5=cdupercentage5

gen afd_parl1=0
gen afd_parl2=0
gen afd_parl3=0
gen afd_parl4=0
gen afd_parl5=0

replace afd_parl1=afdpercentage1
replace afd_parl2=afdpercentage2
replace afd_parl3=afdpercentage3
replace afd_parl4=afdpercentage4
replace afd_parl5=afdpercentage5

gen spd_parl1=0
gen spd_parl2=0
gen spd_parl3=0
gen spd_parl4=0
gen spd_parl5=0

replace spd_parl1=spdpercentage1
replace spd_parl2=spdpercentage2
replace spd_parl3=spdpercentage3
replace spd_parl4=spdpercentage4
replace spd_parl5=spdpercentage5

gen grüne_parl1=0
gen grüne_parl2=0
gen grüne_parl3=0
gen grüne_parl4=0
gen grüne_parl5=0

replace grüne_parl1=grünepercentage1
replace grüne_parl2=grünepercentage2
replace grüne_parl3=grünepercentage3
replace grüne_parl4=grünepercentage4
replace grüne_parl5=grünepercentage5

gen fdp_parl1=0
gen fdp_parl2=0
gen fdp_parl3=0
gen fdp_parl4=0
gen fdp_parl5=0

replace fdp_parl1=fdppercentage1
replace fdp_parl2=fdppercentage2
replace fdp_parl3=fdppercentage3
replace fdp_parl4=fdppercentage4
replace fdp_parl5=fdppercentage5

gen bsw_parl1=0
gen bsw_parl2=0
gen bsw_parl3=0
gen bsw_parl4=0
gen bsw_parl5=0

replace bsw_parl1=bswpercentage1
replace bsw_parl2=bswpercentage2
replace bsw_parl3=bswpercentage3
replace bsw_parl4=bswpercentage4
replace bsw_parl5=bswpercentage5

gen dielinke_parl1=0
gen dielinke_parl2=0
gen dielinke_parl3=0
gen dielinke_parl4=0
gen dielinke_parl5=0

replace dielinke_parl1=dielinkepercentage1
replace dielinke_parl2=dielinkepercentage2
replace dielinke_parl3=dielinkepercentage3
replace dielinke_parl4=dielinkepercentage4
replace dielinke_parl5=dielinkepercentage5

gen cdu_gov1=0
gen cdu_gov2=0
gen cdu_gov3=0
gen cdu_gov4=0
gen cdu_gov5=0

replace cdu_gov1=cducoalitionseats1
replace cdu_gov2=cducoalitionseats2
replace cdu_gov3=cducoalitionseats3
replace cdu_gov4=cducoalitionseats4
replace cdu_gov5=cducoalitionseats5

gen afd_gov1=0
gen afd_gov2=0
gen afd_gov3=0
gen afd_gov4=0
gen afd_gov5=0

replace afd_gov1=afdcoalitionseats1
replace afd_gov2=afdcoalitionseats2
replace afd_gov3=afdcoalitionseats3
replace afd_gov4=afdcoalitionseats4
replace afd_gov5=afdcoalitionseats5

gen spd_gov1=0
gen spd_gov2=0
gen spd_gov3=0
gen spd_gov4=0
gen spd_gov5=0

replace spd_gov1=spdcoalitionseats1
replace spd_gov2=spdcoalitionseats2
replace spd_gov3=spdcoalitionseats3
replace spd_gov4=spdcoalitionseats4
replace spd_gov5=spdcoalitionseats5

gen grüne_gov1=0
gen grüne_gov2=0
gen grüne_gov3=0
gen grüne_gov4=0
gen grüne_gov5=0

replace grüne_gov1=grünecoalitionseats1
replace grüne_gov2=grünecoalitionseats2
replace grüne_gov3=grünecoalitionseats3
replace grüne_gov4=grünecoalitionseats4
replace grüne_gov5=grünecoalitionseats5

gen fdp_gov1=0
gen fdp_gov2=0
gen fdp_gov3=0
gen fdp_gov4=0
gen fdp_gov5=0

replace fdp_gov1=fdpcoalitionseats1
replace fdp_gov2=fdpcoalitionseats2
replace fdp_gov3=fdpcoalitionseats3
replace fdp_gov4=fdpcoalitionseats4
replace fdp_gov5=fdpcoalitionseats5

gen bsw_gov1=0
gen bsw_gov2=0
gen bsw_gov3=0
gen bsw_gov4=0
gen bsw_gov5=0

replace bsw_gov1=bswcoalitionseats1
replace bsw_gov2=bswcoalitionseats2
replace bsw_gov3=bswcoalitionseats3
replace bsw_gov4=bswcoalitionseats4
replace bsw_gov5=bswcoalitionseats5

gen dielinke_gov1=0
gen dielinke_gov2=0
gen dielinke_gov3=0
gen dielinke_gov4=0
gen dielinke_gov5=0

replace dielinke_gov1=dielinkecoalitionseats1
replace dielinke_gov2=dielinkecoalitionseats2
replace dielinke_gov3=dielinkecoalitionseats3
replace dielinke_gov4=dielinkecoalitionseats4
replace dielinke_gov5=dielinkecoalitionseats5


gen cdu_chancellor1=0
gen cdu_chancellor2=0
gen cdu_chancellor3=0
gen cdu_chancellor4=0
gen cdu_chancellor5=0

replace cdu_chancellor1=1 if chancellorparty1=="CDU"
replace cdu_chancellor2=1 if chancellorparty2=="CDU"
replace cdu_chancellor3=1 if chancellorparty3=="CDU"
replace cdu_chancellor4=1 if chancellorparty4=="CDU"
replace cdu_chancellor5=1 if chancellorparty5=="CDU"

gen spd_chancellor1=0
gen spd_chancellor2=0
gen spd_chancellor3=0
gen spd_chancellor4=0
gen spd_chancellor5=0

replace spd_chancellor1=1 if chancellorparty1=="SPD"
replace spd_chancellor2=1 if chancellorparty2=="SPD"
replace spd_chancellor3=1 if chancellorparty3=="SPD"
replace spd_chancellor4=1 if chancellorparty4=="SPD"
replace spd_chancellor5=1 if chancellorparty5=="SPD"

gen grüne_chancellor1=0
gen grüne_chancellor2=0
gen grüne_chancellor3=0
gen grüne_chancellor4=0
gen grüne_chancellor5=0

replace grüne_chancellor1=1 if chancellorparty1=="Grüne"
replace grüne_chancellor2=1 if chancellorparty2=="Grüne"
replace grüne_chancellor3=1 if chancellorparty3=="Grüne"
replace grüne_chancellor4=1 if chancellorparty4=="Grüne"
replace grüne_chancellor5=1 if chancellorparty5=="Grüne"

gen fdp_chancellor1=0
gen fdp_chancellor2=0
gen fdp_chancellor3=0
gen fdp_chancellor4=0
gen fdp_chancellor5=0

replace fdp_chancellor1=1 if chancellorparty1=="FDP"
replace fdp_chancellor2=1 if chancellorparty2=="FDP"
replace fdp_chancellor3=1 if chancellorparty3=="FDP"
replace fdp_chancellor4=1 if chancellorparty4=="FDP"
replace fdp_chancellor5=1 if chancellorparty5=="FDP"

gen bsw_chancellor1=0
gen bsw_chancellor2=0
gen bsw_chancellor3=0
gen bsw_chancellor4=0
gen bsw_chancellor5=0

replace bsw_chancellor1=1 if chancellorparty1=="BSW"
replace bsw_chancellor2=1 if chancellorparty2=="BSW"
replace bsw_chancellor3=1 if chancellorparty3=="BSW"
replace bsw_chancellor4=1 if chancellorparty4=="BSW"
replace bsw_chancellor5=1 if chancellorparty5=="BSW"

gen dielinke_chancellor1=0
gen dielinke_chancellor2=0
gen dielinke_chancellor3=0
gen dielinke_chancellor4=0
gen dielinke_chancellor5=0

replace dielinke_chancellor1=1 if chancellorparty1=="Die Linke"
replace dielinke_chancellor2=1 if chancellorparty2=="Die Linke"
replace dielinke_chancellor3=1 if chancellorparty3=="Die Linke"
replace dielinke_chancellor4=1 if chancellorparty4=="Die Linke"
replace dielinke_chancellor5=1 if chancellorparty5=="Die Linke"

* Arranging indidivudal level variables
***************************************

* Age

gen age=q1

* Gender

gen gender=q2

* education

gen educ=q3

* Region

gen region=q4

* Arranging dependent variables
********************************

gen accept1=q9a
gen accept2=q9b
gen accept3=q9c
gen accept4=q9d
gen accept5=q9e

gen protest1=q10a
gen protest2=q10b
gen protest3=q10c
gen protest4=q10d
gen protest5=q10e

replace protest1=0 if q10a==.
replace protest2=0 if q10b==.
replace protest3=0 if q10c==.
replace protest4=0 if q10d==.
replace protest5=0 if q10e==.

* Removing the 4 respondents who did not answer to one of the dependent variables

drop if accept5==.

* Calculating how many respondents gave the same answer to the five scenarios

gen same=0
replace same=1 if accept1==accept2==accept3==accept4==accept5

* Identifying scenarios that shoulnd't have happpened

gen weird1=0
gen weird2=0
gen weird3=0
gen weird4=0
gen weird5=0

replace weird1=1 if dielinkeincoalition1=="yes" & dielinkepercentage1==0
replace weird2=1 if dielinkeincoalition2=="yes" & dielinkepercentage2==0
replace weird3=1 if (dielinkeincoalition3=="yes" & dielinkepercentage3==0) | (bswincoalition3=="yes" & bswpercentage3==0)
replace weird4=1 if (dielinkeincoalition4=="yes" & dielinkepercentage4==0) | (fdpincoalition4=="yes" & fdppercentage4==0)

replace weird1=1 if totalvotescoalition1>.70
replace weird2=1 if totalvotescoalition2>.70
replace weird3=1 if totalvotescoalition3>.70
replace weird4=1 if totalvotescoalition4>.70
replace weird5=1 if totalvotescoalition5>.70

* Reshaping dataset
*******************

gen id=_n

reshape long fav_parlseats, i(id) j(scenario)

gen least_parlseats=.
gen fav_govseats=.
gen least_govseats=.
gen fav_chancellor=.
gen least_chancellor=.

gen fav_alt_parlseats=.
gen least_alt_parlseats=.
gen fav_alt_govseats=.
gen least_alt_govseats=.
gen fav_alt_chancellor=.
gen least_alt_chancellor=.
gen enpp=.
gen enpg=.
gen number_parties_gov=.
gen number_parties_parl=.
gen largest_in_gov=.
gen totalvotescoalition=.
gen polarization_gov=.
gen cmp_polarization_gov=.
gen frequency=.
gen frequency1949=.
gen accept=.
gen protest=.
gen afd_seats=.
gen afd_govseats=.
gen afd_chancellor=.
gen cdu_gov=.
gen afd_gov=.
gen spd_gov=.
gen grüne_gov=.
gen fdp_gov=.
gen bsw_gov=.
gen dielinke_gov=.
gen cdu_parl=.
gen afd_parl=.
gen spd_parl=.
gen grüne_parl=.
gen fdp_parl=.
gen bsw_parl=.
gen dielinke_parl=.
gen cdu_chancellor=.
gen spd_chancellor=.
gen grüne_chancellor=.
gen fdp_chancellor=.
gen bsw_chancellor=.
gen dielinke_chancellor=. 
gen weird=.

replace least_parlseats=least_parlseats1 if scenario==1
replace least_parlseats=least_parlseats2 if scenario==2
replace least_parlseats=least_parlseats3 if scenario==3
replace least_parlseats=least_parlseats4 if scenario==4
replace least_parlseats=least_parlseats5 if scenario==5

replace fav_govseats=fav_govseats1 if scenario==1
replace fav_govseats=fav_govseats2 if scenario==2
replace fav_govseats=fav_govseats3 if scenario==3
replace fav_govseats=fav_govseats4 if scenario==4
replace fav_govseats=fav_govseats5 if scenario==5

replace least_govseats=least_govseats1 if scenario==1
replace least_govseats=least_govseats2 if scenario==2
replace least_govseats=least_govseats3 if scenario==3
replace least_govseats=least_govseats4 if scenario==4
replace least_govseats=least_govseats5 if scenario==5

replace fav_chancellor=fav_chancellor1 if scenario==1
replace fav_chancellor=fav_chancellor2 if scenario==2
replace fav_chancellor=fav_chancellor3 if scenario==3
replace fav_chancellor=fav_chancellor4 if scenario==4
replace fav_chancellor=fav_chancellor5 if scenario==5

replace least_chancellor=least_chancellor1 if scenario==1
replace least_chancellor=least_chancellor2 if scenario==2
replace least_chancellor=least_chancellor3 if scenario==3
replace least_chancellor=least_chancellor4 if scenario==4
replace least_chancellor=least_chancellor5 if scenario==5


replace fav_alt_parlseats=fav_alt_parlseats1 if scenario==1
replace fav_alt_parlseats=fav_alt_parlseats2 if scenario==2
replace fav_alt_parlseats=fav_alt_parlseats3 if scenario==3
replace fav_alt_parlseats=fav_alt_parlseats4 if scenario==4
replace fav_alt_parlseats=fav_alt_parlseats5 if scenario==5

replace least_alt_parlseats=least_alt_parlseats1 if scenario==1
replace least_alt_parlseats=least_alt_parlseats2 if scenario==2
replace least_alt_parlseats=least_alt_parlseats3 if scenario==3
replace least_alt_parlseats=least_alt_parlseats4 if scenario==4
replace least_alt_parlseats=least_alt_parlseats5 if scenario==5

replace fav_alt_govseats=fav_alt_govseats1 if scenario==1
replace fav_alt_govseats=fav_alt_govseats2 if scenario==2
replace fav_alt_govseats=fav_alt_govseats3 if scenario==3
replace fav_alt_govseats=fav_alt_govseats4 if scenario==4
replace fav_alt_govseats=fav_alt_govseats5 if scenario==5

replace least_alt_govseats=least_alt_govseats1 if scenario==1
replace least_alt_govseats=least_alt_govseats2 if scenario==2
replace least_alt_govseats=least_alt_govseats3 if scenario==3
replace least_alt_govseats=least_alt_govseats4 if scenario==4
replace least_alt_govseats=least_alt_govseats5 if scenario==5

replace fav_alt_chancellor=fav_alt_chancellor1 if scenario==1
replace fav_alt_chancellor=fav_alt_chancellor2 if scenario==2
replace fav_alt_chancellor=fav_alt_chancellor3 if scenario==3
replace fav_alt_chancellor=fav_alt_chancellor4 if scenario==4
replace fav_alt_chancellor=fav_alt_chancellor5 if scenario==5

replace least_alt_chancellor=least_alt_chancellor1 if scenario==1
replace least_alt_chancellor=least_alt_chancellor2 if scenario==2
replace least_alt_chancellor=least_alt_chancellor3 if scenario==3
replace least_alt_chancellor=least_alt_chancellor4 if scenario==4
replace least_alt_chancellor=least_alt_chancellor5 if scenario==5

replace afd_seats=afd_seats1 if scenario==1
replace afd_seats=afd_seats2 if scenario==2
replace afd_seats=afd_seats3 if scenario==3
replace afd_seats=afd_seats4 if scenario==4
replace afd_seats=afd_seats5 if scenario==5

replace afd_govseats=afd_seats1 if scenario==1
replace afd_govseats=afd_seats2 if scenario==2
replace afd_govseats=afd_seats3 if scenario==3
replace afd_govseats=afd_seats4 if scenario==4
replace afd_govseats=afd_seats5 if scenario==5

replace afd_chancellor=afd_chancellor1 if scenario==1
replace afd_chancellor=afd_chancellor2 if scenario==2
replace afd_chancellor=afd_chancellor3 if scenario==3
replace afd_chancellor=afd_chancellor4 if scenario==4
replace afd_chancellor=afd_chancellor5 if scenario==5

replace cdu_gov=cdu_gov1 if scenario==1
replace cdu_gov=cdu_gov2 if scenario==2
replace cdu_gov=cdu_gov3 if scenario==3
replace cdu_gov=cdu_gov4 if scenario==4
replace cdu_gov=cdu_gov5 if scenario==5

replace afd_gov=afd_gov1 if scenario==1
replace afd_gov=afd_gov2 if scenario==2
replace afd_gov=afd_gov3 if scenario==3
replace afd_gov=afd_gov4 if scenario==4
replace afd_gov=afd_gov5 if scenario==5

replace spd_gov=spd_gov1 if scenario==1
replace spd_gov=spd_gov2 if scenario==2
replace spd_gov=spd_gov3 if scenario==3
replace spd_gov=spd_gov4 if scenario==4
replace spd_gov=spd_gov5 if scenario==5

replace grüne_gov=grüne_gov1 if scenario==1
replace grüne_gov=grüne_gov2 if scenario==2
replace grüne_gov=grüne_gov3 if scenario==3
replace grüne_gov=grüne_gov4 if scenario==4
replace grüne_gov=grüne_gov5 if scenario==5

replace fdp_gov=fdp_gov1 if scenario==1
replace fdp_gov=fdp_gov2 if scenario==2
replace fdp_gov=fdp_gov3 if scenario==3
replace fdp_gov=fdp_gov4 if scenario==4
replace fdp_gov=fdp_gov5 if scenario==5

replace bsw_gov=bsw_gov1 if scenario==1
replace bsw_gov=bsw_gov2 if scenario==2
replace bsw_gov=bsw_gov3 if scenario==3
replace bsw_gov=bsw_gov4 if scenario==4
replace bsw_gov=bsw_gov5 if scenario==5


replace dielinke_gov=dielinke_gov1 if scenario==1
replace dielinke_gov=dielinke_gov2 if scenario==2
replace dielinke_gov=dielinke_gov3 if scenario==3
replace dielinke_gov=dielinke_gov4 if scenario==4
replace dielinke_gov=dielinke_gov5 if scenario==5

replace afd_parl=afd_parl1 if scenario==1
replace afd_parl=afd_parl2 if scenario==2
replace afd_parl=afd_parl3 if scenario==3
replace afd_parl=afd_parl4 if scenario==4
replace afd_parl=afd_parl5 if scenario==5

replace cdu_parl=cdu_parl1 if scenario==1
replace cdu_parl=cdu_parl2 if scenario==2
replace cdu_parl=cdu_parl3 if scenario==3
replace cdu_parl=cdu_parl4 if scenario==4
replace cdu_parl=cdu_parl5 if scenario==5

replace spd_parl=spd_parl1 if scenario==1
replace spd_parl=spd_parl2 if scenario==2
replace spd_parl=spd_parl3 if scenario==3
replace spd_parl=spd_parl4 if scenario==4
replace spd_parl=spd_parl5 if scenario==5

replace grüne_parl=grüne_parl1 if scenario==1
replace grüne_parl=grüne_parl2 if scenario==2
replace grüne_parl=grüne_parl3 if scenario==3
replace grüne_parl=grüne_parl4 if scenario==4
replace grüne_parl=grüne_parl5 if scenario==5

replace fdp_parl=fdp_parl1 if scenario==1
replace fdp_parl=fdp_parl2 if scenario==2
replace fdp_parl=fdp_parl3 if scenario==3
replace fdp_parl=fdp_parl4 if scenario==4
replace fdp_parl=fdp_parl5 if scenario==5

replace bsw_parl=bsw_parl1 if scenario==1
replace bsw_parl=bsw_parl2 if scenario==2
replace bsw_parl=bsw_parl3 if scenario==3
replace bsw_parl=bsw_parl4 if scenario==4
replace bsw_parl=bsw_parl5 if scenario==5


replace dielinke_parl=dielinke_parl1 if scenario==1
replace dielinke_parl=dielinke_parl2 if scenario==2
replace dielinke_parl=dielinke_parl3 if scenario==3
replace dielinke_parl=dielinke_parl4 if scenario==4
replace dielinke_parl=dielinke_parl5 if scenario==5

replace cdu_chancellor=cdu_chancellor1 if scenario==1
replace cdu_chancellor=cdu_chancellor2 if scenario==2
replace cdu_chancellor=cdu_chancellor3 if scenario==3
replace cdu_chancellor=cdu_chancellor4 if scenario==4
replace cdu_chancellor=cdu_chancellor5 if scenario==5

replace spd_chancellor=spd_chancellor1 if scenario==1
replace spd_chancellor=spd_chancellor2 if scenario==2
replace spd_chancellor=spd_chancellor3 if scenario==3
replace spd_chancellor=spd_chancellor4 if scenario==4
replace spd_chancellor=spd_chancellor5 if scenario==5

replace grüne_chancellor=grüne_chancellor1 if scenario==1
replace grüne_chancellor=grüne_chancellor2 if scenario==2
replace grüne_chancellor=grüne_chancellor3 if scenario==3
replace grüne_chancellor=grüne_chancellor4 if scenario==4
replace grüne_chancellor=grüne_chancellor5 if scenario==5

replace fdp_chancellor=fdp_chancellor1 if scenario==1
replace fdp_chancellor=fdp_chancellor2 if scenario==2
replace fdp_chancellor=fdp_chancellor3 if scenario==3
replace fdp_chancellor=fdp_chancellor4 if scenario==4
replace fdp_chancellor=fdp_chancellor5 if scenario==5

replace bsw_chancellor=bsw_chancellor1 if scenario==1
replace bsw_chancellor=bsw_chancellor2 if scenario==2
replace bsw_chancellor=bsw_chancellor3 if scenario==3
replace bsw_chancellor=bsw_chancellor4 if scenario==4
replace bsw_chancellor=bsw_chancellor5 if scenario==5

replace dielinke_chancellor=dielinke_chancellor1 if scenario==1
replace dielinke_chancellor=dielinke_chancellor2 if scenario==2
replace dielinke_chancellor=dielinke_chancellor3 if scenario==3
replace dielinke_chancellor=dielinke_chancellor4 if scenario==4
replace dielinke_chancellor=dielinke_chancellor5 if scenario==5

replace enpp=enpp1 if scenario==1
replace enpp=enpp2 if scenario==2
replace enpp=enpp3 if scenario==3
replace enpp=enpp4 if scenario==4
replace enpp=enpp5 if scenario==5

replace enpg=enpg1 if scenario==1
replace enpg=enpg2 if scenario==2
replace enpg=enpg3 if scenario==3
replace enpg=enpg4 if scenario==4
replace enpg=enpg5 if scenario==5

replace number_parties_gov=number_parties_gov1 if scenario==1
replace number_parties_gov=number_parties_gov2 if scenario==2
replace number_parties_gov=number_parties_gov3 if scenario==3
replace number_parties_gov=number_parties_gov4 if scenario==4
replace number_parties_gov=number_parties_gov5 if scenario==5

replace number_parties_parl=number_parties_parl1 if scenario==1
replace number_parties_parl=number_parties_parl2 if scenario==2
replace number_parties_parl=number_parties_parl3 if scenario==3
replace number_parties_parl=number_parties_parl4 if scenario==4
replace number_parties_parl=number_parties_parl5 if scenario==5

replace largest_in_gov=largest_in_gov1 if scenario==1
replace largest_in_gov=largest_in_gov2 if scenario==2
replace largest_in_gov=largest_in_gov3 if scenario==3
replace largest_in_gov=largest_in_gov4 if scenario==4
replace largest_in_gov=largest_in_gov5 if scenario==5

replace totalvotescoalition=totalvotescoalition1 if scenario==1
replace totalvotescoalition=totalvotescoalition2 if scenario==2
replace totalvotescoalition=totalvotescoalition3 if scenario==3
replace totalvotescoalition=totalvotescoalition4 if scenario==4
replace totalvotescoalition=totalvotescoalition5 if scenario==5

replace polarization_gov=polarization_gov1 if scenario==1
replace polarization_gov=polarization_gov2 if scenario==2
replace polarization_gov=polarization_gov3 if scenario==3
replace polarization_gov=polarization_gov4 if scenario==4
replace polarization_gov=polarization_gov5 if scenario==5

replace cmp_polarization_gov=cmp_polarization_gov1 if scenario==1
replace cmp_polarization_gov=cmp_polarization_gov2 if scenario==2
replace cmp_polarization_gov=cmp_polarization_gov3 if scenario==3
replace cmp_polarization_gov=cmp_polarization_gov4 if scenario==4
replace cmp_polarization_gov=cmp_polarization_gov5 if scenario==5

replace cmp_polarization_gov=cmp_polarization_gov1 if scenario==1
replace cmp_polarization_gov=cmp_polarization_gov2 if scenario==2
replace cmp_polarization_gov=cmp_polarization_gov3 if scenario==3
replace cmp_polarization_gov=cmp_polarization_gov4 if scenario==4
replace cmp_polarization_gov=cmp_polarization_gov5 if scenario==5

replace frequency1949=frequency1_1949 if scenario==1
replace frequency1949=frequency2_1949 if scenario==2
replace frequency1949=frequency3_1949 if scenario==3
replace frequency1949=frequency4_1949 if scenario==4
replace frequency1949=frequency5_1949 if scenario==5

replace frequency=frequency1 if scenario==1
replace frequency=frequency2 if scenario==2
replace frequency=frequency3 if scenario==3
replace frequency=frequency4 if scenario==4
replace frequency=frequency5 if scenario==5

replace accept=accept1 if scenario==1
replace accept=accept2 if scenario==2
replace accept=accept3 if scenario==3
replace accept=accept4 if scenario==4
replace accept=accept5 if scenario==5

replace protest=protest1 if scenario==1
replace protest=protest2 if scenario==2
replace protest=protest3 if scenario==3
replace protest=protest4 if scenario==4
replace protest=protest5 if scenario==5

replace weird=weird1 if scenario==1
replace weird=weird2 if scenario==2
replace weird=weird3 if scenario==3
replace weird=weird4 if scenario==4
replace weird=weird5 if scenario==5

* Standardizing covariates

egen enpg_stand=std(enpg) if weird==0
egen largest_in_gov_stand=std(largest_in_gov) if weird==0
egen polarization_gov_stand=std(polarization_gov) if weird==0
egen frequency_stand=std(frequency) if weird==0
egen totalvotescoalition_stand=std(totalvotescoalition) if weird==0
egen enpp_stand=std(enpp) if weird==0
egen fav_parlseats_stand=std(fav_parlseats) if weird==0
egen fav_govseats_stand=std(fav_govseats) if weird==0
egen fav_chancellor_stand=std(fav_chancellor) if weird==0
egen least_parlseats_stand=std(least_parlseats) if weird==0
egen least_govseats_stand=std(least_govseats) if weird==0
egen least_chancellor_stand=std(least_chancellor) if weird==0

* Keeping relevant variables

keep id fav_parlseats least_parlseats fav_govseats least_govseats fav_chancellor least_chancellor fav_alt_parlseats least_alt_parlseats fav_alt_govseats least_alt_govseats fav_alt_chancellor least_alt_chancellor enpp enpg number_parties_gov number_parties_parl largest_in_gov totalvotescoalition bsw_gov polarization_gov cmp_polarization_gov frequency accept protest age gender educ region afd_seats afd_chancellor afd_govseats fav2 least2 min_liking max_liking fav1 fav2 fav3 fav4 fav5 fav6 fav7 least1 least2 least3 least4 least5 least6 least7 same cdu_gov afd_gov spd_gov grüne_gov fdp_gov bsw_gov dielinke_gov cdu_parl afd_parl spd_parl grüne_parl fdp_parl bsw_parl dielinke_parl cdu_chancellor afd_chancellor spd_chancellor grüne_chancellor fdp_chancellor bsw_chancellor dielinke_chancellor q5a q5b q5c q5d q5e q5f q5g weird scenario durationinseconds fav_parlseats_stand least_parlseats_stand  fav_govseats_stand  least_govseats_stand  fav_chancellor_stand  least_chancellor_stand  enpp_stand enpg_stand polarization_gov_stand largest_in_gov_stand totalvotescoalition_stand frequency_stand frequency1949 mild_pref

* Descriptive statistics
************************

sum accept protest if weird==0

tab accept if weird==0
tab protest if weird==0

hist accept if weird==0, percent scheme(s2mono) graphregion(color(white)) xtitle("Accept") ytitle("Percentage") xlabel(0(1)10) ylabel(0(10)60)
graph save hist1.gph, replace

hist protest if weird==0, percent scheme(s2mono) graphregion(color(white)) xtitle("Protest") ytitle("Percentage") xlabel(0(1)10) ylabel(0(10)60)
graph save hist2.gph, replace

graph combine hist1.gph hist2.gph
graph export hist.png, replace

corr accept protest if weird==0
corr accept protest if weird==0 & same==0
corr accept protest if weird==0 & accept<5

sum durationinseconds if weird==0

gen missing_pref=0
replace missing_pref=1 if fav_parlseats==.

tab missing_pref if weird==0

sum fav_parlseats fav_alt_parlseats least_parlseats least_alt_parlseats fav_govseats fav_alt_govseats least_govseats least_alt_govseats fav_chancellor fav_alt_chancellor least_chancellor least_alt_chancellor enpp number_parties_parl enpg number_parties_gov largest_in_gov polarization_gov cmp_polarization_gov frequency frequency1949 totalvotescoalition if weird==0

sum accept protest if weird==0 & fav1==1
sum accept protest if weird==0 & fav2==1
sum accept protest if weird==0 & fav3==1
sum accept protest if weird==0 & fav4==1
sum accept protest if weird==0 & fav5==1
sum accept protest if weird==0 & fav6==1
sum accept protest if weird==0 & fav7==1

* Bar graphs
************

tab least1 if scenario==1
tab least2 if scenario==1
tab least3 if scenario==1
tab least4 if scenario==1
tab least5 if scenario==1
tab least6 if scenario==1
tab least7 if scenario==1

tab least2 if scenario==1 & fav4==1
tab least4 if scenario==1 & fav2==1


graph hbar (mean) accept protest if fav2==1 & weird==0 & grüne_gov=0, blabel(bar, format(%4.2f) position(top)) ylabel(0(1)6, grid) ytitle("Consent of AfD supporters (Greens not in government)") scheme(s2mono) graphregion(color(white)) legend(label(1 "Accept") label(2 "Protest"))
graph save bar1.gph, replace

graph hbar (mean) accept protest if fav2==1 & weird==0 & grüne_gov>0, blabel(bar, format(%4.2f) position(top)) ylabel(0(1)6, grid) ytitle("Consent of AfD supporters (Greens in government)") scheme(s2mono) graphregion(color(white)) legend(label(1 "Accept") label(2 "Protest"))
graph save bar2.gph, replace

graph hbar (mean) accept protest if fav4==1 & weird==0 & afd_gov==0, blabel(bar, format(%4.2f) position(top)) ylabel(0(1)6, grid) ytitle("Consent of Greens supporters (AfD not in government)") scheme(s2mono) graphregion(color(white)) legend(label(1 "Accept") label(2 "Protest"))
graph save bar3.gph, replace

graph hbar (mean) accept protest if fav4==1 & weird==0 & afd_gov>0, blabel(bar, format(%4.2f) position(top)) ylabel(0(1)6, grid) ytitle("Consent of Greens supporters (AfD in government)") scheme(s2mono) graphregion(color(white)) legend(label(1 "Accept") label(2 "Protest"))
graph save bar4.gph, replace

graph combine bar1.gph bar2.gph bar3.gph bar4.gph, row(2)
graph export bars.png, replace

* Analysis partisan hypotheses
******************************

* Accept

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
estimate store Accept

test fav_govseats=-least_govseats
test fav_chancellor=-least_chancellor


drop fav_parlseats_stand
drop least_parlseats_stand
drop fav_govseats_stand
drop least_govseats_stand
drop fav_chancellor_stand
drop least_chancellor_stand

egen fav_parlseats_stand=std(fav_alt_parlseats) if weird==0
egen least_parlseats_stand=std(least_alt_parlseats) if weird==0
egen fav_govseats_stand=std(fav_alt_govseats) if weird==0
egen least_govseats_stand=std(least_alt_govseats) if weird==0
egen fav_chancellor_stand=std(fav_alt_chancellor) if weird==0
egen least_chancellor_stand=std(least_alt_chancellor) if weird==0

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
estimate store B

drop fav_parlseats_stand
drop least_parlseats_stand
drop fav_govseats_stand
drop least_govseats_stand
drop fav_chancellor_stand
drop least_chancellor_stand

egen fav_parlseats_stand=std(fav_parlseats) if weird==0
egen least_parlseats_stand=std(least_parlseats) if weird==0
egen fav_govseats_stand=std(fav_govseats) if weird==0
egen least_govseats_stand=std(least_govseats) if weird==0
egen fav_chancellor_stand=std(fav_chancellor) if weird==0
egen least_chancellor_stand=std(least_chancellor) if weird==0

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & scenario==1, vce(cluster id)
estimate store C

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & bsw_gov==0, vce(cluster id)
estimate store D

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & mild_pref==0, vce(cluster id)
estimate store E

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand age i.gender i.educ i.region if weird==0, vce(cluster id)
estimate store F


* Protest

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
estimate store Protest

test fav_govseats=-least_govseats
test fav_chancellor=-least_chancellor


drop fav_parlseats_stand
drop least_parlseats_stand
drop fav_govseats_stand
drop least_govseats_stand
drop fav_chancellor_stand
drop least_chancellor_stand

egen fav_parlseats_stand=std(fav_alt_parlseats) if weird==0
egen least_parlseats_stand=std(least_alt_parlseats) if weird==0
egen fav_govseats_stand=std(fav_alt_govseats) if weird==0
egen least_govseats_stand=std(least_alt_govseats) if weird==0
egen fav_chancellor_stand=std(fav_alt_chancellor) if weird==0
egen least_chancellor_stand=std(least_alt_chancellor) if weird==0

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
estimate store H

drop fav_parlseats_stand
drop least_parlseats_stand
drop fav_govseats_stand
drop least_govseats_stand
drop fav_chancellor_stand
drop least_chancellor_stand

egen fav_parlseats_stand=std(fav_parlseats) if weird==0
egen least_parlseats_stand=std(least_parlseats) if weird==0
egen fav_govseats_stand=std(fav_govseats) if weird==0
egen least_govseats_stand=std(least_govseats) if weird==0
egen fav_chancellor_stand=std(fav_chancellor) if weird==0
egen least_chancellor_stand=std(least_chancellor) if weird==0

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & scenario==1, vce(cluster id)
estimate store I

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & bsw_gov==0, vce(cluster id)
estimate store J


reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & mild_pref==0, vce(cluster id)
estimate store K

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand age i.gender i.educ i.region if weird==0, vce(cluster id)
estimate store L

* Figure 

coefplot ///
(Accept, offset(0.40) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(circle) label(Baseline)) ///
(B, offset(0.25) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(diamond) label(Alternative measures)) ///
(C, offset(0.10) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(triangle) label(First iteration)) ///
(D, offset(-0.05) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(square) label(No BSW government)) ///
(E, offset(-0.20) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(arrow) label(No mild preference)) ///
(F, offset(-0.35) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(plus) label(Controls)) ///
|| ///
(Protest, offset(0.40) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(circle) ) ///
(H, offset(0.25) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(diamond)) ///
(I, offset(0.10) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(triangle)) ///
(J, offset(-0.05) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(square)) ///
(K, offset(-0.20) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(arrow)) ///
(L, offset(-0.35) keep(fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(plus)) ///
, coeflabels(fav_govseats_stand = "Most liked party" least_govseats_stand="Most disliked party" fav_parlseats_stand= "Most liked party" least_parlseats_stand="Most disliked party" fav_chancellor_stand="Most liked party" least_chancellor_stand="Least liked party") headings(fav_parlseats_stand="{bf:Parliament seats}"  fav_govseats_stand="{bf:Cabinet seats}" fav_chancellor_stand="{bf:Chancellorship}") xline(0, lp(dash)) scheme(s1mono) levels(95) ytitle("") ylabel(, grid) xlabel(, grid) legend(order(2 4 6 8 10 12) cols(3)) title("") byopts(legend(center) cols(2) compact) xtitle("") xlabel(-1(0.2)0.8) subtitle(, justification(center))

graph export political.png, replace


* Analysis structural variables
*******************************

* Accept

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand if weird==0, vce(cluster id)
estimate store Accept

drop enpg_stand
drop polarization_gov_stand
drop enpp_stand
drop frequency_stand

egen enpg_stand=std(number_parties_gov) if weird==0
egen polarization_gov_stand=std(cmp_polarization_gov) if weird==0
egen frequency_stand=std(frequency1949) if weird==0
egen enpp_stand=std(number_parties_parl) if weird==0

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand if weird==0, vce(cluster id)
estimate store B

drop enpg_stand
drop polarization_gov_stand
drop frequency_stand
drop enpp_stand

egen enpg_stand=std(enpg) if weird==0
egen polarization_gov_stand=std(polarization_gov) if weird==0
egen frequency_stand=std(frequency) if weird==0
egen enpp_stand=std(enpp) if weird==0

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand if weird==0 & bsw_gov==0, vce(cluster id)
estimate store C

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand if weird==0 & scenario==1, vce(cluster id)
estimate store D

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand age gender i.educ i.region if weird==0, vce(cluster id)
estimate store E

* Protest

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand if weird==0, vce(cluster id)
estimate store Protest

drop enpg_stand
drop polarization_gov_stand
drop enpp_stand
drop frequency_stand

egen enpg_stand=std(number_parties_gov) if weird==0
egen polarization_gov_stand=std(cmp_polarization_gov) if weird==0
egen frequency_stand=std(frequency1949) if weird==0
egen enpp_stand=std(number_parties_parl) if weird==0

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand if weird==0, vce(cluster id)
estimate store G

drop enpg_stand
drop polarization_gov_stand
drop frequency_stand
drop enpp_stand

egen enpg_stand=std(enpg) if weird==0
egen polarization_gov_stand=std(polarization_gov) if weird==0
egen frequency_stand=std(frequency) if weird==0
egen enpp_stand=std(enpp) if weird==0

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand if weird==0 & scenario==1, vce(cluster id)
estimate store H

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand if weird==0 & bsw_gov==0, vce(cluster id)
estimate store I

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand polarization_gov_stand frequency_stand totalvotescoalition_stand age gender i.educ i.region if weird==0, vce(cluster id)
estimate store J

* Figure

coefplot ///
(Accept, offset(0.3) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(circle) label(Baseline)) ///
(B, offset(0.15) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(diamond) label(Alternative measures)) ///
(C, offset(0) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(triangle) label(First iteration)) ///
(D, offset(-0.15) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(square) label(No BSW government)) ///
(E, offset(-0.3) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(plus) label(Controls)) ///
|| ///
(Protest, offset(0.3) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(circle) ) ///
(G, offset(0.15) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(diamond)) ///
(H, offset(0) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(triangle)) ///
(I, offset(-0.15) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(square)) ///
(J, offset(-0.3) keep(enpp_stand enpg_stand largest_in_gov_stand  polarization_gov_stand frequency_stand) mfcolor(black) mcolor(black) ciopts(color(black)) msize(.65) msymbol(plus)) ///
, coeflabels(enpp_stand="Number of parliamentary parties" enpg_stand ="Number of governing parties" largest_in_gov_stand="Largest party in government" polarization_gov_stand="Polarization of governing parties" frequency_stand="Frequency of coalition") xline(0, lp(dash)) scheme(s1mono) levels(95) ytitle("") ylabel(, grid) xlabel(, grid) legend(order(2 4 6 8 10) cols(3)) title("") byopts(legend(center) cols(2) compact) xtitle("") xlabel(-.6(0.1)0.4) subtitle(, justification(center))


graph export structual.png, replace


* Appendix 4
*************

* Accept

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
outreg2 using appendix3.doc, se dec(3) alpha(0.01, 0.05) replace

drop fav_parlseats_stand
drop least_parlseats_stand
drop fav_govseats_stand
drop least_govseats_stand
drop fav_chancellor_stand
drop least_chancellor_stand

egen fav_parlseats_stand=std(fav_alt_parlseats) if weird==0
egen least_parlseats_stand=std(least_alt_parlseats) if weird==0
egen fav_govseats_stand=std(fav_alt_govseats) if weird==0
egen least_govseats_stand=std(least_alt_govseats) if weird==0
egen fav_chancellor_stand=std(fav_alt_chancellor) if weird==0
egen least_chancellor_stand=std(least_alt_chancellor) if weird==0

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
outreg2 using appendix3.doc, se dec(3) alpha(0.01, 0.05) append

drop fav_parlseats_stand
drop least_parlseats_stand
drop fav_govseats_stand
drop least_govseats_stand
drop fav_chancellor_stand
drop least_chancellor_stand

egen fav_parlseats_stand=std(fav_parlseats) if weird==0
egen least_parlseats_stand=std(least_parlseats) if weird==0
egen fav_govseats_stand=std(fav_govseats) if weird==0
egen least_govseats_stand=std(least_govseats) if weird==0
egen fav_chancellor_stand=std(fav_chancellor) if weird==0
egen least_chancellor_stand=std(least_chancellor) if weird==0

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & scenario==1, vce(cluster id)
outreg2 using appendix3.doc, se dec(3) alpha(0.01, 0.05) append

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & bsw_gov==0, vce(cluster id)
outreg2 using appendix3.doc, se dec(3) alpha(0.01, 0.05) append

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & mild_pref==0, vce(cluster id)
outreg2 using appendix3.doc, se dec(3) alpha(0.01, 0.05) append

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand age i.gender i.educ i.region if weird==0, vce(cluster id)
outreg2 using appendix3.doc, se dec(3) alpha(0.01, 0.05) append

* Protest

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
outreg2 using appendix3_protest.doc, se dec(3) alpha(0.01, 0.05) replace

drop fav_parlseats_stand
drop least_parlseats_stand
drop fav_govseats_stand
drop least_govseats_stand
drop fav_chancellor_stand
drop least_chancellor_stand

egen fav_parlseats_stand=std(fav_alt_parlseats) if weird==0
egen least_parlseats_stand=std(least_alt_parlseats) if weird==0
egen fav_govseats_stand=std(fav_alt_govseats) if weird==0
egen least_govseats_stand=std(least_alt_govseats) if weird==0
egen fav_chancellor_stand=std(fav_alt_chancellor) if weird==0
egen least_chancellor_stand=std(least_alt_chancellor) if weird==0

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
outreg2 using appendix3_protest.doc, se dec(3) alpha(0.01, 0.05) append

drop fav_parlseats_stand
drop least_parlseats_stand
drop fav_govseats_stand
drop least_govseats_stand
drop fav_chancellor_stand
drop least_chancellor_stand

egen fav_parlseats_stand=std(fav_parlseats) if weird==0
egen least_parlseats_stand=std(least_parlseats) if weird==0
egen fav_govseats_stand=std(fav_govseats) if weird==0
egen least_govseats_stand=std(least_govseats) if weird==0
egen fav_chancellor_stand=std(fav_chancellor) if weird==0
egen least_chancellor_stand=std(least_chancellor) if weird==0

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & scenario==1, vce(cluster id)
outreg2 using appendix3_protest.doc, se dec(3) alpha(0.01, 0.05) append


reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & bsw_gov==0, vce(cluster id)
outreg2 using appendix3_protest.doc, se dec(3) alpha(0.01, 0.05) append


reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & mild_pref==0, vce(cluster id)
outreg2 using appendix3_protest.doc, se dec(3) alpha(0.01, 0.05) append

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand age i.gender i.educ i.region if weird==0, vce(cluster id)
estimate store L
outreg2 using appendix3_protest.doc, se dec(3) alpha(0.01, 0.05) append


* Appendix 5
*************

* Accept

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
outreg2 using appendix4.doc, se dec(3) alpha(0.01, 0.05) replace

drop enpg_stand
drop polarization_gov_stand
drop enpp_stand
drop frequency_stand

egen enpg_stand=std(number_parties_gov) if weird==0
egen polarization_gov_stand=std(cmp_polarization_gov) if weird==0
egen frequency_stand=std(frequency1949) if weird==0
egen enpp_stand=std(number_parties_parl) if weird==0

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
outreg2 using appendix4.doc, se dec(3) alpha(0.01, 0.05) append

drop enpg_stand
drop polarization_gov_stand
drop frequency_stand
drop enpp_stand

egen enpg_stand=std(enpg) if weird==0
egen polarization_gov_stand=std(polarization_gov) if weird==0
egen frequency_stand=std(frequency) if weird==0
egen enpp_stand=std(enpp) if weird==0

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & scenario==1, vce(cluster id)
outreg2 using appendix4.doc, se dec(3) alpha(0.01, 0.05) append

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & bsw_gov==0, vce(cluster id)
outreg2 using appendix4.doc, se dec(3) alpha(0.01, 0.05) append

reg accept fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand age gender i.educ i.region if weird==0, vce(cluster id)
outreg2 using appendix4.doc, se dec(3) alpha(0.01, 0.05) append

* Protest

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
outreg2 using appendix4_protest.doc, se dec(3) alpha(0.01, 0.05) replace

drop enpg_stand
drop polarization_gov_stand
drop enpp_stand
drop frequency_stand

egen enpg_stand=std(number_parties_gov) if weird==0
egen polarization_gov_stand=std(cmp_polarization_gov) if weird==0
egen frequency_stand=std(frequency1949) if weird==0
egen enpp_stand=std(number_parties_parl) if weird==0

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0, vce(cluster id)
outreg2 using appendix4_protest.doc, se dec(3) alpha(0.01, 0.05) append

drop enpg_stand
drop polarization_gov_stand
drop frequency_stand
drop enpp_stand

egen enpg_stand=std(enpg) if weird==0
egen polarization_gov_stand=std(polarization_gov) if weird==0
egen frequency_stand=std(frequency) if weird==0
egen enpp_stand=std(enpp) if weird==0

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & scenario==1, vce(cluster id)
outreg2 using appendix4_protest.doc, se dec(3) alpha(0.01, 0.05) append

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand if weird==0 & bsw_gov==0, vce(cluster id)
outreg2 using appendix4_protest.doc, se dec(3) alpha(0.01, 0.05) append

reg protest fav_parlseats_stand least_parlseats_stand fav_govseats_stand least_govseats_stand fav_chancellor_stand least_chancellor_stand enpp_stand enpg_stand largest_in_gov_stand totalvotescoalition_stand polarization_gov_stand frequency_stand age gender i.educ i.region if weird==0, vce(cluster id)
outreg2 using appendix4_protest.doc, se dec(3) alpha(0.01, 0.05) append

* Appendix 6
*************

* Accept

reg accept fav_parlseats least_parlseats fav_govseats least_govseats fav_chancellor least_chancellor enpp enpg largest_in_gov totalvotescoalition polarization_gov frequency if weird==0, vce(cluster id)
outreg2 using appendix5.doc, se dec(3) alpha(0.01, 0.05) replace

* Protest

reg protest fav_parlseats least_parlseats fav_govseats least_govseats fav_chancellor least_chancellor enpp enpg largest_in_gov totalvotescoalition polarization_gov frequency if weird==0, vce(cluster id)
outreg2 using appendix5.doc, se dec(3) alpha(0.01, 0.05) append




